クラス OidcAuthorizationCodeAuthenticationProvider
java.lang.ObjectSE
org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider
- 実装されたすべてのインターフェース:
AuthenticationProvider
public class OidcAuthorizationCodeAuthenticationProvider
extends ObjectSE
implements AuthenticationProvider
OpenID Connect Core 1.0 認証コード認可フロー用の
AuthenticationProvider
の実装。 この AuthenticationProvider
は、認可サーバーのトークンエンドポイントで認可コードの資格情報を認証し、有効な場合はアクセストークンの資格情報と交換します。
また、OAuth2UserService
を使用して UserInfo エンドポイントからエンドユーザー(リソース所有者)のユーザー属性を取得し、OidcUser
の形式で Principal
を作成します。次に、OidcUser
が OAuth2LoginAuthenticationToken
に関連付けられ、認証が完了します。
コンストラクターのサマリー
コンストラクターコンストラクター説明OidcAuthorizationCodeAuthenticationProvider
(OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient, OAuth2UserService<OidcUserRequest, OidcUser> userService) 指定されたパラメーターを使用してOidcAuthorizationCodeAuthenticationProvider
を構築します。メソッドのサマリー
修飾子と型メソッド説明authenticate
(Authentication authentication) AuthenticationManager.authenticate(Authentication)
と同じ契約で認証を実行します。final void
setAuthoritiesMapper
(GrantedAuthoritiesMapper authoritiesMapper) OAuth2AuthenticatedPrincipal.getAuthorities()
} のマッピングに使用されるGrantedAuthoritiesMapper
を、OAuth2LoginAuthenticationToken
に関連付けられる新しい権限のセットに設定します。final void
setJwtDecoderFactory
(JwtDecoderFactory<ClientRegistration> jwtDecoderFactory) OidcIdToken
署名検証に使用されるJwtDecoderFactory
を設定します。boolean
このAuthenticationProvider
が指定されたAuthentication
オブジェクトをサポートする場合、true
を返します。
コンストラクターの詳細
OidcAuthorizationCodeAuthenticationProvider
public OidcAuthorizationCodeAuthenticationProvider(OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient, OAuth2UserService<OidcUserRequest, OidcUser> userService) 指定されたパラメーターを使用してOidcAuthorizationCodeAuthenticationProvider
を構築します。- パラメーター:
accessTokenResponseClient
- トークンエンドポイントからアクセストークンクレデンシャルをリクエストするために使用されるクライアントuserService
- UserInfo エンドポイントからエンドユーザーのユーザー属性を取得するために使用されるサービス
メソッドの詳細
authenticate
インターフェースからコピーされた説明:AuthenticationProvider
AuthenticationManager.authenticate(Authentication)
と同じ契約で認証を実行します。- 次で指定:
- インターフェース
AuthenticationProvider
のauthenticate
- パラメーター:
authentication
- 認証リクエストオブジェクト。- 戻り値:
- 資格情報を含む完全に認証されたオブジェクト。
AuthenticationProvider
が、渡されたAuthentication
オブジェクトの認証をサポートできない場合、null
を返すことがあります。そのような場合、提示されたAuthentication
クラスをサポートする次のAuthenticationProvider
が試行されます。 - 例外:
AuthenticationException
- 認証が失敗した場合。
setJwtDecoderFactory
OidcIdToken
署名検証に使用されるJwtDecoderFactory
を設定します。ファクトリは、提供されたClientRegistration
に関連付けられたJwtDecoder
を返します。- パラメーター:
jwtDecoderFactory
-OidcIdToken
署名検証に使用されるJwtDecoderFactory
- 導入:
- 5.2
setAuthoritiesMapper
OAuth2AuthenticatedPrincipal.getAuthorities()
} のマッピングに使用されるGrantedAuthoritiesMapper
を、OAuth2LoginAuthenticationToken
に関連付けられる新しい権限のセットに設定します。- パラメーター:
authoritiesMapper
- ユーザーの権限のマッピングに使用されるGrantedAuthoritiesMapper
supports
インターフェースからコピーされた説明:AuthenticationProvider
このAuthenticationProvider
が指定されたAuthentication
オブジェクトをサポートする場合、true
を返します。true
を返しても、AuthenticationProvider
が提示されたAuthentication
オブジェクトを認証できることは保証されません。これは単に、より詳細な評価をサポートできることを示しているだけです。AuthenticationProvider
は、AuthenticationProvider.authenticate(Authentication)
メソッドからnull
を返して、別のAuthenticationProvider
を試す必要があることを示すことができます。認証を実行できる
AuthenticationProvider
の選択は、実行時にProviderManager
で行われます。- 次で指定:
- インターフェース
AuthenticationProvider
のsupports
- 戻り値:
- 実装が提示された
Authentication
クラスをより厳密に評価できる場合はtrue