クラス JwtIssuerReactiveAuthenticationManagerResolver
java.lang.ObjectSE
org.springframework.security.oauth2.server.resource.authentication.JwtIssuerReactiveAuthenticationManagerResolver
- 実装されたすべてのインターフェース:
ReactiveAuthenticationManagerResolver<org.springframework.web.server.ServerWebExchange>
public final class JwtIssuerReactiveAuthenticationManagerResolver
extends ObjectSE
implements ReactiveAuthenticationManagerResolver<org.springframework.web.server.ServerWebExchange>
署名付き JWT (JWS) の発行者に基づいて JWT ベースの
ReactiveAuthenticationManager
を解決する ReactiveAuthenticationManagerResolver
の実装。このクラスを使用するには、`iss` クレームが信頼できるかどうかを判断できる必要があります。誰でも認可サーバーを立ち上げて、リソースサーバーに有効なトークンを発行できることを思い出してください。これを実現する最も簡単な方法は、コンストラクターで信頼できる発行者のセットを指定することです。このクラスは、ServerWebExchange
のベアラートークンにある `iss` クレームから Issuer を派生します。- 導入:
- 5.3
コンストラクターのサマリー
コンストラクターコンストラクター説明JwtIssuerReactiveAuthenticationManagerResolver
(StringSE... trustedIssuers) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。JwtIssuerReactiveAuthenticationManagerResolver
(CollectionSE<StringSE> trustedIssuers) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。JwtIssuerReactiveAuthenticationManagerResolver
(ReactiveAuthenticationManagerResolver<StringSE> issuerAuthenticationManagerResolver) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成するこのコンストラクターで提供されたReactiveAuthenticationManagerResolver
は、発行者が信頼できることを確認する必要があることに注意してください。メソッドのサマリー
修飾子と型メソッド説明fromTrustedIssuers
(StringSE... trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成しますfromTrustedIssuers
(CollectionSE<StringSE> trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成しますfromTrustedIssuers
(PredicateSE<StringSE> trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成しますreactor.core.publisher.Mono<ReactiveAuthenticationManager>
resolve
(org.springframework.web.server.ServerWebExchange exchange) リクエストのベアラートークンで見つかった `iss` クレームに基づいてAuthenticationManager
を返します
コンストラクターの詳細
JwtIssuerReactiveAuthenticationManagerResolver
@DeprecatedSE(since="6.2", forRemoval=true) public JwtIssuerReactiveAuthenticationManagerResolver(StringSE... trustedIssuers) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成します- パラメーター:
trustedIssuers
- 信頼できる発行者の配列
JwtIssuerReactiveAuthenticationManagerResolver
@DeprecatedSE(since="6.2", forRemoval=true) public JwtIssuerReactiveAuthenticationManagerResolver(CollectionSE<StringSE> trustedIssuers) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成します- パラメーター:
trustedIssuers
- 信頼できる発行者のコレクション
JwtIssuerReactiveAuthenticationManagerResolver
public JwtIssuerReactiveAuthenticationManagerResolver(ReactiveAuthenticationManagerResolver<StringSE> issuerAuthenticationManagerResolver) 指定されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を構築します。このコンストラクターで提供されるReactiveAuthenticationManagerResolver
は、発行者が信頼できることを確認する必要があることに注意してください。これは、許可された発行者のセットを介して実行する必要があります。これを実現する 1 つの方法は、キーが既知の発行者であるMap
SE を使用することです。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
SE のキーは、信頼できる発行者です。- パラメーター:
issuerAuthenticationManagerResolver
- 発行者がReactiveAuthenticationManager
を解決するための戦略
メソッドの詳細
fromTrustedIssuers
public static JwtIssuerReactiveAuthenticationManagerResolver fromTrustedIssuers(StringSE... trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成します- パラメーター:
trustedIssuers
- 信頼できる発行者の配列- 導入:
- 6.2
fromTrustedIssuers
public static JwtIssuerReactiveAuthenticationManagerResolver fromTrustedIssuers(CollectionSE<StringSE> trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成します- パラメーター:
trustedIssuers
- 信頼できる発行者のコレクション- 導入:
- 6.2
fromTrustedIssuers
public static JwtIssuerReactiveAuthenticationManagerResolver fromTrustedIssuers(PredicateSE<StringSE> trustedIssuers) 提供されたパラメーターを使用してJwtIssuerReactiveAuthenticationManagerResolver
を作成します- パラメーター:
trustedIssuers
- 発行者を検証する述語- 導入:
- 6.2
resolve
public reactor.core.publisher.Mono<ReactiveAuthenticationManager> resolve(org.springframework.web.server.ServerWebExchange exchange) リクエストのベアラートークンで見つかった `iss` クレームに基づいてAuthenticationManager
を返します- 次で指定:
- インターフェース
ReactiveAuthenticationManagerResolver<org.springframework.web.server.ServerWebExchange>
のresolve
- 例外:
OAuth2AuthenticationException
- ベアラートークンの形式が正しくない場合、またはReactiveAuthenticationManager
を発行者から取得できない場合
fromTrustedIssuers(String...)
を使用