クラス RSocketSecurity
- java.lang.Object
-
- org.springframework.security.config.annotation.rsocket.RSocketSecurity
public class RSocketSecurity extends java.lang.ObjectRSocket ベースのセキュリティを設定できます。最小限の例を以下に示します。@EnableRSocketSecurity public class SecurityConfig { @Bean PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsocket) { rsocket .authorizePayload((authorize) -> authorize .anyRequest().authenticated() ); return rsocket.build(); } @Bean public MapReactiveUserDetailsService userDetailsService() { UserDetails user = User.withDefaultPasswordEncoder() .username("user") .password("password") .roles("USER") .build(); return new MapReactiveUserDetailsService(user); } }より高度な構成を以下に示します。@EnableRSocketSecurity public class SecurityConfig { @Bean PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsocket) { rsocket .authorizePayload((authorize) -> authorize // must have ROLE_SETUP to make connection .setup().hasRole("SETUP") // must have ROLE_ADMIN for routes starting with "admin." .route("admin.*").hasRole("ADMIN") // any other request must be authenticated for .anyRequest().authenticated() ); return rsocket.build(); } }- 導入:
- 5.2
ネストされたクラスの概要
ネストされたクラス 修飾子と型 クラス 説明 classRSocketSecurity.AuthorizePayloadsSpecclassRSocketSecurity.BasicAuthenticationSpecclassRSocketSecurity.JwtSpecclassRSocketSecurity.SimpleAuthenticationSpec
コンストラクターの概要
コンストラクター コンストラクター 説明 RSocketSecurity()
方法の概要
すべてのメソッド インスタンスメソッド 具象メソッド 非推奨のメソッド 修飾子と型 メソッド 説明 RSocketSecurityaddPayloadInterceptor(PayloadInterceptor interceptor)使用するPayloadInterceptorを追加します。RSocketSecurityauthenticationManager(ReactiveAuthenticationManager authenticationManager)RSocketSecurityauthorizePayload(Customizer<RSocketSecurity.AuthorizePayloadsSpec> authorize)RSocketSecuritybasicAuthentication(Customizer<RSocketSecurity.BasicAuthenticationSpec> basic)使用すべきではありません。PayloadSocketAcceptorInterceptorbuild()RSocketSecurityjwt(Customizer<RSocketSecurity.JwtSpec> jwt)protected voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)RSocketSecuritysimpleAuthentication(Customizer<RSocketSecurity.SimpleAuthenticationSpec> simple)単純認証を使用してユーザー名とパスワードを検証するためのサポートを追加します
メソッドの詳細
addPayloadInterceptor
public RSocketSecurity addPayloadInterceptor(PayloadInterceptor interceptor)
使用するPayloadInterceptorを追加します。これは通常、DSL の使用がユーザーのニーズを満たさない場合にのみ使用されます。PayloadInterceptorが適切な順序で実行されるようにするために、PayloadInterceptorはOrderedを実装するか、Orderでアノテーションを付ける必要があります。- パラメーター:
interceptor-- 戻り値:
- 追加のカスタマイズのためのビルダー
- 関連事項:
PayloadInterceptorOrder
authenticationManager
public RSocketSecurity authenticationManager(ReactiveAuthenticationManager authenticationManager)
simpleAuthentication
public RSocketSecurity simpleAuthentication(Customizer<RSocketSecurity.SimpleAuthenticationSpec> simple)
単純認証を使用してユーザー名とパスワードを検証するためのサポートを追加します- パラメーター:
simple- カスタマイザ- 戻り値:
- 追加構成のための RSocketSecurity
- 導入:
- 5.3
basicAuthentication
@Deprecated public RSocketSecurity basicAuthentication(Customizer<RSocketSecurity.BasicAuthenticationSpec> basic)
使用すべきではありません。BasicAuthenticationPayloadExchangeConverter による認証を追加します。- パラメーター:
basic-- 戻り値:
- このインスタンス
jwt
public RSocketSecurity jwt(Customizer<RSocketSecurity.JwtSpec> jwt)
authorizePayload
public RSocketSecurity authorizePayload(Customizer<RSocketSecurity.AuthorizePayloadsSpec> authorize)
build
public PayloadSocketAcceptorInterceptor build()
setApplicationContext
protected void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- 例外:
org.springframework.beans.BeansException