クラス NimbusJwtDecoder.PublicKeyJwtDecoderBuilder

java.lang.ObjectSE
org.springframework.security.oauth2.jwt.NimbusJwtDecoder.PublicKeyJwtDecoderBuilder
含まれているクラス:
NimbusJwtDecoder

public static final class NimbusJwtDecoder.PublicKeyJwtDecoderBuilder extends ObjectSE
公開鍵に基づいて NimbusJwtDecoder インスタンスを作成するためのビルダー。
  • メソッドの詳細

    • validateType

      public NimbusJwtDecoder.PublicKeyJwtDecoderBuilder validateType(boolean shouldValidateTypHeader)
      Nimbus の typ ヘッダー検証を使用するかどうか。デフォルトは false です。

      この機能をオンにすると、NimbusJwtDecoder は Nimbus のデフォルトの JOSEObjectTypeVerifier を使用して、typ ヘッダーのチェックを Nimbus に委譲します。

      これを false に設定すると、 NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer).build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuer); になります。

      これはこれと同等である:  NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer) .validateType(false) .build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithValidators( new JwtIssuerValidator(issuer), JwtTypeValidator.jwt());

      違いは、これを false に設定することで、at+jwt の場合のように型による検証が可能になることです:  NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer) .validateType(false) .build(); jwtDecoder.setJwtValidator(new MyAtJwtValidator());

      パラメーター:
      shouldValidateTypHeader - Nimbus が typ ヘッダーを検証するかどうか
      戻り値:
      さらなる構成のための NimbusJwtDecoder.JwkSetUriJwtDecoderBuilder
      導入:
      6.5
    • signatureAlgorithm

      public NimbusJwtDecoder.PublicKeyJwtDecoderBuilder signatureAlgorithm(SignatureAlgorithm signatureAlgorithm)
      指定された署名アルゴリズムを使用します。値は RS256、RS384、RS512 のいずれかである必要があります。
      パラメーター:
      signatureAlgorithm - 使用するアルゴリズム
      戻り値:
      さらなる構成のための NimbusJwtDecoder.PublicKeyJwtDecoderBuilder
    • jwtProcessorCustomizer

      public NimbusJwtDecoder.PublicKeyJwtDecoderBuilder jwtProcessorCustomizer(ConsumerSE<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.SecurityContext>> jwtProcessorCustomizer)
      指定された ConsumerSE を使用して、ビルド NimbusJwtDecoder に渡す前に ConfigurableJWTProcessor をカスタマイズします。
      パラメーター:
      jwtProcessorCustomizer - プロセッサーを変更するために使用されるコールバック
      戻り値:
      さらなる構成のための NimbusJwtDecoder.PublicKeyJwtDecoderBuilder
      導入:
      5.4
    • build

      public NimbusJwtDecoder build()
      構成された NimbusJwtDecoder をビルドします。
      戻り値:
      設定された NimbusJwtDecoder