クラス 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

        public JwtAuthenticationProvider​(JwtDecoder jwtDecoder)
    • メソッドの詳細

      • supports

        public boolean supports​(java.lang.Class<?> authentication)
        インターフェースからコピーされた説明: AuthenticationProvider
        この AuthenticationProvider が指定された Authentication オブジェクトをサポートする場合、true を返します。

        true を返すことは、AuthenticationProvider が Authentication クラスの提示されたインスタンスを認証できることを保証しません。それは、それがより詳細な評価をサポートできることを示しています。AuthenticationProvider は、AuthenticationProvider.authenticate(Authentication) メソッドから null を返して、別の AuthenticationProvider を試す必要があることを示すことができます。

        認証を実行できる AuthenticationProvider の選択は、実行時に ProviderManager で行われます。

        次で指定:
        インターフェース AuthenticationProvidersupports 
        戻り値:
        実装が提示された Authentication クラスをより厳密に評価できる場合は true 
      • setJwtAuthenticationConverter

        public void setJwtAuthenticationConverter​(org.springframework.core.convert.converter.Converter<Jwt,​? extends AbstractAuthenticationToken> jwtAuthenticationConverter)