クラス ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec
java.lang.ObjectSE
org.springframework.security.config.web.server.ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec
- 含まれているクラス:
- ServerHttpSecurity.SessionManagementSpec
特定のユーザーに許可されるセッションの数を構成します。
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明maximumSessions
(SessionLimit sessionLimit) ユーザーに許可されるセッションの最大数を設定します。maximumSessionsExceededHandler
(ServerMaximumSessionsExceededHandler maximumSessionsExceededHandler) 最大セッション数を超えたときに使用するServerMaximumSessionsExceededHandler
を設定します。sessionRegistry
(ReactiveSessionRegistry reactiveSessionRegistry) 使用するReactiveSessionRegistry
を設定します。
コンストラクターの詳細
ConcurrentSessionsSpec
public ConcurrentSessionsSpec()
メソッドの詳細
sessionRegistry
public ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec sessionRegistry(ReactiveSessionRegistry reactiveSessionRegistry) 使用するReactiveSessionRegistry
を設定します。- パラメーター:
reactiveSessionRegistry
- 使用するReactiveSessionRegistry
- 戻り値:
ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec
のカスタマイズを続ける
maximumSessions
public ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec maximumSessions(SessionLimit sessionLimit) ユーザーに許可されるセッションの最大数を設定します。SessionLimit.of(int)
を使用して正の整数を指定するか、SessionLimit.UNLIMITED
を使用して無制限のセッションを許可できます。ユーザーごとに最大セッション数をカスタマイズするには、次のようにカスタムSessionLimit
実装を提供します。http .sessionManagement((sessions) -> sessions .concurrentSessions((concurrency) -> concurrency .maximumSessions((authentication) -> { if (authentication.getName().equals("admin")) { return Mono.empty() // unlimited sessions for admin } return Mono.just(1); // one session for every other user }) ) )
- パラメーター:
sessionLimit
- ユーザーに許可されるセッションの最大数- 戻り値:
ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec
のカスタマイズを続ける
maximumSessionsExceededHandler
public ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec maximumSessionsExceededHandler(ServerMaximumSessionsExceededHandler maximumSessionsExceededHandler) 最大セッション数を超えたときに使用するServerMaximumSessionsExceededHandler
を設定します。- パラメーター:
maximumSessionsExceededHandler
- 使用するServerMaximumSessionsExceededHandler
- 戻り値:
ServerHttpSecurity.SessionManagementSpec.ConcurrentSessionsSpec
のカスタマイズを続ける