クラス ServerHttpSecurity.CsrfSpec
- java.lang.Object
-
- org.springframework.security.config.web.server.ServerHttpSecurity.CsrfSpec
- 含まれているクラス:
- ServerHttpSecurity
public final class ServerHttpSecurity.CsrfSpec extends java.lang.Object
CSRF の保護を構成します- 導入:
- 5.0
- 関連事項:
ServerHttpSecurity.csrf()
メソッドのサマリー
すべてのメソッド インスタンスメソッド 具象メソッド 修飾子と型 メソッド 説明 ServerHttpSecurity.CsrfSpec
accessDeniedHandler(ServerAccessDeniedHandler accessDeniedHandler)
CSRF トークンが無効な場合に使用されるServerAccessDeniedHandler
を構成します。ServerHttpSecurity
and()
メソッドチェーンがServerHttpSecurity
の構成を続行できるようにしますprotected void
configure(ServerHttpSecurity http)
ServerHttpSecurity.CsrfSpec
csrfTokenRepository(ServerCsrfTokenRepository csrfTokenRepository)
CSRF トークンを永続化するために使用されるServerCsrfTokenRepository
を構成します。ServerHttpSecurity
disable()
CSRF 保護を無効にします。ServerHttpSecurity.CsrfSpec
requireCsrfProtectionMatcher(ServerWebExchangeMatcher requireCsrfProtectionMatcher)
CSRF 保護がいつ有効になるかを決定するために使用されるServerWebExchangeMatcher
を構成します。ServerHttpSecurity.CsrfSpec
tokenFromMultipartDataEnabled(boolean enabled)
CsrfWebFilter
がマルチパートデータリクエストの本文から実際の CSRF トークンを解決しようとするかどうかを指定します。
メソッドの詳細
accessDeniedHandler
public ServerHttpSecurity.CsrfSpec accessDeniedHandler(ServerAccessDeniedHandler accessDeniedHandler)
CSRF トークンが無効な場合に使用されるServerAccessDeniedHandler
を構成します。デフォルトでは、HttpStatus.FORBIDDEN
を送信します。- パラメーター:
accessDeniedHandler
- アクセス拒否ハンドラー。- 戻り値:
- 追加構成のための
ServerHttpSecurity.CsrfSpec
csrfTokenRepository
public ServerHttpSecurity.CsrfSpec csrfTokenRepository(ServerCsrfTokenRepository csrfTokenRepository)
CSRF トークンを永続化するために使用されるServerCsrfTokenRepository
を構成します。デフォルトはWebSessionServerCsrfTokenRepository
です。- パラメーター:
csrfTokenRepository
- 使用するリポジトリ- 戻り値:
- 追加構成のための
ServerHttpSecurity.CsrfSpec
requireCsrfProtectionMatcher
public ServerHttpSecurity.CsrfSpec requireCsrfProtectionMatcher(ServerWebExchangeMatcher requireCsrfProtectionMatcher)
CSRF 保護がいつ有効になるかを決定するために使用されるServerWebExchangeMatcher
を構成します。デフォルトは PUT、POST、DELETE リクエストです。- パラメーター:
requireCsrfProtectionMatcher
- 使用するマッチャー- 戻り値:
- 追加構成のための
ServerHttpSecurity.CsrfSpec
tokenFromMultipartDataEnabled
public ServerHttpSecurity.CsrfSpec tokenFromMultipartDataEnabled(boolean enabled)
CsrfWebFilter
がマルチパートデータリクエストの本文から実際の CSRF トークンを解決しようとするかどうかを指定します。- パラメーター:
enabled
- マルチパートフォーム本体から読み取る必要がある場合は true、それ以外の場合は false。デフォルトは false です- 戻り値:
- 追加構成のための
ServerHttpSecurity.CsrfSpec
and
public ServerHttpSecurity and()
メソッドチェーンがServerHttpSecurity
の構成を続行できるようにします- 戻り値:
ServerHttpSecurity
の構成を続行するには
disable
public ServerHttpSecurity disable()
CSRF 保護を無効にします。CSRF 保護を無効にすることは、アプリケーションがブラウザー内で使用されない場合にのみ推奨されます。- 戻り値:
ServerHttpSecurity
の構成を続行するには
configure
protected void configure(ServerHttpSecurity http)