クラス OAuth2AuthorizationCodeRequestAuthenticationProvider
java.lang.ObjectSE
org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationProvider
- 実装済みのインターフェース一覧:
AuthenticationProvider
public final class OAuth2AuthorizationCodeRequestAuthenticationProvider
extends ObjectSE
implements AuthenticationProvider
認可コード付与で使用される OAuth 2.0 認可リクエストの
AuthenticationProvider 実装。- 導入:
- 7.0
- 関連事項:
OAuth2AuthorizationCodeRequestAuthenticationTokenOAuth2AuthorizationCodeRequestAuthenticationValidatorOAuth2AuthorizationCodeAuthenticationProviderOAuth2AuthorizationConsentAuthenticationProviderRegisteredClientRepositoryOAuth2AuthorizationServiceOAuth2AuthorizationConsentService- セクション 4.1.1 認可リクエスト
- セクション 3.1.2.1 認証リクエスト
コンストラクター概要
コンストラクターコンストラクター説明OAuth2AuthorizationCodeRequestAuthenticationProvider(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) 指定されたパラメーターを使用してOAuth2AuthorizationCodeRequestAuthenticationProviderを構築します。方法の概要
修飾子と型メソッド説明authenticate(Authentication authentication) AuthenticationManager.authenticate(Authentication)と同じ契約で認証を実行します。voidsetAuthenticationValidator(ConsumerSE<OAuth2AuthorizationCodeRequestAuthenticationContext> authenticationValidator) OAuth2AuthorizationCodeRequestAuthenticationContextへのアクセスを提供するConsumerを設定し、OAuth2AuthorizationCodeRequestAuthenticationTokenに関連付けられた特定の OAuth 2.0 認可リクエストパラメーターを検証します。voidsetAuthorizationCodeGenerator(OAuth2TokenGenerator<OAuth2AuthorizationCode> authorizationCodeGenerator) OAuth2AuthorizationCodeを生成するOAuth2TokenGeneratorを設定します。voidsetAuthorizationConsentRequired(PredicateSE<OAuth2AuthorizationCodeRequestAuthenticationContext> authorizationConsentRequired) 認可同意が必要かどうかを判断するために使用されるPredicateを設定します。booleanこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートしている場合は、trueを返します。
コンストラクターの詳細
OAuth2AuthorizationCodeRequestAuthenticationProvider
public OAuth2AuthorizationCodeRequestAuthenticationProvider(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) 指定されたパラメーターを使用してOAuth2AuthorizationCodeRequestAuthenticationProviderを構築します。- パラメーター:
registeredClientRepository- 登録済みクライアントのリポジトリauthorizationService- 認可サービスauthorizationConsentService- 認可同意サービス
メソッドの詳細
authenticate
インターフェースからコピーされた説明:AuthenticationProviderAuthenticationManager.authenticate(Authentication)と同じ契約で認証を実行します。- 次で指定:
- インターフェース
AuthenticationProviderのauthenticate - パラメーター:
authentication- 認証リクエストオブジェクト。- 戻り値:
- 資格情報を含む完全に認証されたオブジェクト。
AuthenticationProviderが、渡されたAuthenticationオブジェクトの認証をサポートできない場合、nullを返すことがあります。そのような場合、提示されたAuthenticationクラスをサポートする次のAuthenticationProviderが試行されます。 - 例外:
AuthenticationException- 認証が失敗した場合。
supports
インターフェースからコピーされた説明:AuthenticationProviderこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。trueを返しても、AuthenticationProviderが提示されたAuthenticationオブジェクトを認証できることは保証されません。これは単に、より詳細な評価をサポートできることを示しているだけです。AuthenticationProviderは、AuthenticationProvider.authenticate(Authentication)メソッドからnullを返して、別のAuthenticationProviderを試す必要があることを示すことができます。認証を実行できる
AuthenticationProviderの選択は、実行時にProviderManagerによって行われます。- 次で指定:
- インターフェース
AuthenticationProviderのsupports - 戻り値:
- 実装が提示された
Authenticationクラスをより厳密に評価できる場合はtrue
setAuthorizationCodeGenerator
public void setAuthorizationCodeGenerator(OAuth2TokenGenerator<OAuth2AuthorizationCode> authorizationCodeGenerator) OAuth2AuthorizationCodeを生成するOAuth2TokenGeneratorを設定します。- パラメーター:
authorizationCodeGenerator-OAuth2AuthorizationCodeを生成するOAuth2TokenGenerator
setAuthenticationValidator
public void setAuthenticationValidator(ConsumerSE<OAuth2AuthorizationCodeRequestAuthenticationContext> authenticationValidator) OAuth2AuthorizationCodeRequestAuthenticationContextへのアクセスを提供するConsumerを設定し、OAuth2AuthorizationCodeRequestAuthenticationTokenに関連付けられた特定の OAuth 2.0 認可リクエストパラメーターを検証します。デフォルトの認証バリデータはOAuth2AuthorizationCodeRequestAuthenticationValidatorです。注意 : 検証が失敗した場合、認証バリデーターは
OAuth2AuthorizationCodeRequestAuthenticationExceptionをスローする必要があります。- パラメーター:
authenticationValidator-OAuth2AuthorizationCodeRequestAuthenticationContextへのアクセスを提供するConsumerは、特定の OAuth 2.0 認可リクエストパラメーターの検証を担当します。
setAuthorizationConsentRequired
public void setAuthorizationConsentRequired(PredicateSE<OAuth2AuthorizationCodeRequestAuthenticationContext> authorizationConsentRequired) 認可同意が必要かどうかを判断するために使用されるPredicateを設定します。OAuth2AuthorizationCodeRequestAuthenticationContextは述語にOAuth2AuthorizationCodeRequestAuthenticationTokenへのアクセスと、次のコンテキスト属性を提供します。- 認可リクエストに関連付けられた
RegisteredClient。 - 認可リクエストパラメーターを含む
OAuth2AuthorizationRequest。 - 以前に
RegisteredClientに付与されたOAuth2AuthorizationConsent、または利用できない場合はnull。
- パラメーター:
authorizationConsentRequired- 認可同意が必要かどうかを判断するために使用されるPredicate
- 認可リクエストに関連付けられた