Package org.springframework.security.web.csrf

# Interface CsrfTokenRequestHandler

All Superinterfaces:
  `CsrfTokenRequestResolver`

All Known Implementing Classes:
  `CsrfTokenRequestAttributeHandler`, `XorCsrfTokenRequestAttributeHandler`

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 CsrfTokenRequestHandler extends CsrfTokenRequestResolver
A callback interface that is used to make the `CsrfToken` created by the `CsrfTokenRepository` available as a request attribute. Implementations of this interface may choose to perform additional tasks or customize how the token is made available to the application through request attributes.

Since:
  5.8
See Also:
  - `CsrfTokenRequestAttributeHandler`

## Method Summary

Modifier and Type
Method
Description
`void`
`handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Supplier<CsrfToken> csrfToken)`
Handles a request using a `CsrfToken`.
`default String`
`resolveCsrfTokenValue(jakarta.servlet.http.HttpServletRequest request, CsrfToken csrfToken)`
Returns the token value resolved from the provided `HttpServletRequest` and `CsrfToken` or `null` if not available.

## Method Details

### handle

void handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Supplier<CsrfToken> csrfToken)
Handles a request using a `CsrfToken`.

Parameters:
  `request` - the `HttpServletRequest` being handled
  `response` - the `HttpServletResponse` being handled
  `csrfToken` - the `CsrfToken` created by the `CsrfTokenRepository`

### resolveCsrfTokenValue

default String resolveCsrfTokenValue(jakarta.servlet.http.HttpServletRequest request, CsrfToken csrfToken)
Description copied from interface: `CsrfTokenRequestResolver`
Returns the token value resolved from the provided `HttpServletRequest` and `CsrfToken` or `null` if not available.

Specified by:
  `resolveCsrfTokenValue` in interface `CsrfTokenRequestResolver`
Parameters:
  `request` - the `HttpServletRequest` being processed
  `csrfToken` - the `CsrfToken` created by the `CsrfTokenRepository`
Returns:
  the token value resolved from the request