クラス JwtAuthenticationProvider
java.lang.ObjectSE
org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationProvider
- 実装済みのインターフェース一覧:
AuthenticationProvider
OAuth 2.0 リソースサーバーを保護するための
Jwt -encoded ベアラートークンの AuthenticationProvider 実装。 この AuthenticationProvider は、Jwt -encoded アクセストークンのデコードと検証を行い、Authentication ステートメントの一部としてそのクレームセットを返します。
スコープは、次のアルゴリズムに従って GrantedAuthority に変換されます。1. 「スコープ」または "scp" 属性 がある場合、StringSE の場合はスペースで分割して返すか、CollectionSE の場合は単に返す 2. 結果の CollectionSE を取得します。StringSE の先頭に "SCOPE_" キーワードを追加し、GrantedAuthority として追加します。
- 導入:
- 5.1
- 関連事項:
コンストラクター概要
コンストラクター方法の概要
修飾子と型メソッド説明authenticate(Authentication authentication) ベアラートークンをデコードして検証します。voidsetJwtAuthenticationConverter(org.springframework.core.convert.converter.Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter) booleanこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートしている場合は、trueを返します。
コンストラクターの詳細
JwtAuthenticationProvider
メソッドの詳細
authenticate
ベアラートークンをデコードして検証します。- 次で指定:
- インターフェース
AuthenticationProviderのauthenticate - パラメーター:
authentication- 認証リクエストオブジェクト。- 戻り値:
- 成功した認証
- 例外:
AuthenticationException- 何らかの理由で認証に失敗した場合
supports
インターフェースからコピーされた説明:AuthenticationProviderこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。trueを返しても、AuthenticationProviderが提示されたAuthenticationオブジェクトを認証できることは保証されません。これは単に、より詳細な評価をサポートできることを示しているだけです。AuthenticationProviderは、AuthenticationProvider.authenticate(Authentication)メソッドからnullを返して、別のAuthenticationProviderを試す必要があることを示すことができます。認証を実行できる
AuthenticationProviderの選択は、実行時にProviderManagerによって行われます。- 次で指定:
- インターフェース
AuthenticationProviderのsupports - 戻り値:
- 実装が提示された
Authenticationクラスをより厳密に評価できる場合はtrue
setJwtAuthenticationConverter
public void setJwtAuthenticationConverter(org.springframework.core.convert.converter.Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter)