クラス JwtAuthenticationProvider
- java.lang.Object
-
- org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationProvider
- 実装されたすべてのインターフェース:
AuthenticationProvider
public final class JwtAuthenticationProvider extends java.lang.Object implements AuthenticationProvider
OAuth 2.0 リソースサーバーを保護するためのJwt
-encoded ベアラートークンのAuthenticationProvider
実装。この
AuthenticationProvider
は、Jwt
-encoded アクセストークンのデコードと検証を行い、Authentication
ステートメントの一部としてそのクレームセットを返します。スコープは、次のアルゴリズムに従って
GrantedAuthority
に変換されます。1.「スコープ」または "scp" 属性が存在する場合、String
が存在する場合はスペースで分割して戻るか、Collection
が存在する場合は 2 を返します。結果のCollection
を取得します。String
の "SCOPE_" キーワードを先頭に追加し、GrantedAuthority
として追加します。- 導入:
- 5.1
- 関連事項:
AuthenticationProvider
,JwtDecoder
コンストラクターのサマリー
コンストラクター コンストラクター 説明 JwtAuthenticationProvider(JwtDecoder jwtDecoder)
メソッドのサマリー
すべてのメソッド インスタンスメソッド 具象メソッド 修飾子と型 メソッド 説明 Authentication
authenticate(Authentication authentication)
ベアラートークンをデコードして検証します。void
setJwtAuthenticationConverter(org.springframework.core.convert.converter.Converter<Jwt,? extends AbstractAuthenticationToken> jwtAuthenticationConverter)
boolean
supports(java.lang.Class<?> authentication)
このAuthenticationProvider
が指定されたAuthentication
オブジェクトをサポートする場合、true
を返します。
コンストラクターの詳細
JwtAuthenticationProvider
public JwtAuthenticationProvider(JwtDecoder jwtDecoder)
メソッドの詳細
authenticate
public Authentication authenticate(Authentication authentication) throws AuthenticationException
ベアラートークンをデコードして検証します。- 次で指定:
- インターフェース
AuthenticationProvider
のauthenticate
- パラメーター:
authentication
- 認証リクエストオブジェクト。- 戻り値:
- 成功した認証
- 例外:
AuthenticationException
- 何らかの理由で認証に失敗した場合
supports
public boolean supports(java.lang.Class<?> authentication)
インターフェースからコピーされた説明: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)