クラス JwtIssuerReactiveAuthenticationManagerResolver

  • 実装されたすべてのインターフェース:
    ReactiveAuthenticationManagerResolver<org.springframework.web.server.ServerWebExchange>

    public final class JwtIssuerReactiveAuthenticationManagerResolver
    extends java.lang.Object
    implements ReactiveAuthenticationManagerResolver<org.springframework.web.server.ServerWebExchange>
    署名された JWT(JWS)の発行者に基づいて JWT ベースの ReactiveAuthenticationManager を解決する ReactiveAuthenticationManagerResolver の実装。使用するには、このクラスは `iss` クレームが信頼できるかどうかを判別できる必要があります。誰でも認証サーバーを立ち上げて、リソースサーバーに有効なトークンを発行できることを思い出してください。これを実現する最も簡単な方法は、コンストラクターで信頼できる発行者のリストを提供することです。このクラスは、ServerWebExchangeベアラートークンにある `iss` クレームから発行者を派生させます。
    導入:
    5.3
    • コンストラクターの詳細

      • JwtIssuerReactiveAuthenticationManagerResolver

        public JwtIssuerReactiveAuthenticationManagerResolver​(java.lang.String... trustedIssuers)
        提供されたパラメーターを使用して JwtIssuerReactiveAuthenticationManagerResolver を作成します
        パラメーター:
        trustedIssuers - 信頼できる発行者のリスト
      • JwtIssuerReactiveAuthenticationManagerResolver

        public JwtIssuerReactiveAuthenticationManagerResolver​(java.util.Collection<java.lang.String> trustedIssuers)
        提供されたパラメーターを使用して JwtIssuerReactiveAuthenticationManagerResolver を作成します
        パラメーター:
        trustedIssuers - 信頼できる発行者のコレクション
      • JwtIssuerReactiveAuthenticationManagerResolver

        public JwtIssuerReactiveAuthenticationManagerResolver​(ReactiveAuthenticationManagerResolver<java.lang.String> issuerAuthenticationManagerResolver)
        提供されたパラメーターを使用して JwtIssuerReactiveAuthenticationManagerResolver を構築するこのコンストラクターで提供された ReactiveAuthenticationManagerResolver は、発行者が信頼されていることを確認する必要があることに注意してください。これは、発行者の許可されたリストを介して実行する必要があります。これを実現する 1 つの方法は、キーが既知の発行者である Map を使用することです。
             Map<String, ReactiveAuthenticationManager> authenticationManagers = new HashMap<>();
             authenticationManagers.put("https://issuerOne.example.org", managerOne);
             authenticationManagers.put("https://issuerTwo.example.org", managerTwo);
             JwtIssuerReactiveAuthenticationManagerResolver resolver = new JwtIssuerReactiveAuthenticationManagerResolver
                ((issuer) -> Mono.justOrEmpty(authenticationManagers.get(issuer));
         
        Map のキーは、信頼できる発行者です。
        パラメーター:
        issuerAuthenticationManagerResolver - 発行者が ReactiveAuthenticationManager を解決するための戦略