Package org.springframework.security.web.server.csrf

# Interface ServerCsrfTokenRequestHandler

All Superinterfaces:
  `ServerCsrfTokenRequestResolver`

All Known Implementing Classes:
  `ServerCsrfTokenRequestAttributeHandler`, `XorServerCsrfTokenRequestAttributeHandler`

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ServerCsrfTokenRequestHandler extends ServerCsrfTokenRequestResolver
A callback interface that is used to make the `CsrfToken` created by the `ServerCsrfTokenRepository` available as an exchange attribute. Implementations of this interface may choose to perform additional tasks or customize how the token is made available to the application through exchange attributes.

Since:
  5.8
See Also:
  - `ServerCsrfTokenRequestAttributeHandler`

## Method Summary

Modifier and Type
Method
Description
`void`
`handle(org.springframework.web.server.ServerWebExchange exchange, reactor.core.publisher.Mono<CsrfToken> csrfToken)`
Handles a request using a `CsrfToken`.
`default reactor.core.publisher.Mono<String>`
`resolveCsrfTokenValue(org.springframework.web.server.ServerWebExchange exchange, CsrfToken csrfToken)`
Returns the token value resolved from the provided `ServerWebExchange` and `CsrfToken` or `Mono.empty()` if not available.

## Method Details

### handle

void handle(org.springframework.web.server.ServerWebExchange exchange, reactor.core.publisher.Mono<CsrfToken> csrfToken)
Handles a request using a `CsrfToken`.

Parameters:
  `exchange` - the `ServerWebExchange` with the request being handled
  `csrfToken` - the `Mono<CsrfToken>` created by the `ServerCsrfTokenRepository`

### resolveCsrfTokenValue

default reactor.core.publisher.Mono<String> resolveCsrfTokenValue(org.springframework.web.server.ServerWebExchange exchange, CsrfToken csrfToken)
Description copied from interface: `ServerCsrfTokenRequestResolver`
Returns the token value resolved from the provided `ServerWebExchange` and `CsrfToken` or `Mono.empty()` if not available.

Specified by:
  `resolveCsrfTokenValue` in interface `ServerCsrfTokenRequestResolver`
Parameters:
  `exchange` - the `ServerWebExchange` with the request being processed
  `csrfToken` - the `CsrfToken` created by the `ServerCsrfTokenRepository`
Returns:
  the token value resolved from the request