Class CSRFDoubleSubmitCookieInterceptor.Builder
- Enclosing class:
CSRFDoubleSubmitCookieInterceptor<A extends ExchangeContext,
B extends Exchange<A>>
A CSRF double submit cookie interceptor builder.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The cookie name.protected String
The CSRF token cookie domain parameter.protected String
The header name.protected Boolean
The CSRF token cookie httpOnly parameter.protected Integer
The CSRF token cookie max age parameter.protected String
The parameter name.protected String
The CSRF token cookie path parameter.protected Boolean
The CSRF token cookie secure parameter. -
Constructor Summary
ModifierConstructorDescriptionprotected
Builder()
Creates a CSRF double submit cookie interceptor builder. -
Method Summary
Modifier and TypeMethodDescription<A extends ExchangeContext,
B extends Exchange<A>>
CSRFDoubleSubmitCookieInterceptor<A, B> build()
Builds a CSRF double submit cookie interceptor.cookieName
(String cookieName) Specifies the name of the CSRF token cookie.Specifies the domain of the CSRF token cookie.headerName
(String headerName) Specifies the name of the CSRF token header.httpOnly
(boolean httpOnly) Specifies thehttpOnly
flag of the CSRF token cookie.maxAge
(int maxAge) Specifies the max age of the CSRF token cookie.parameterName
(String parameterName) Specifies the name of the CSRF token parameter.Specifies the path of the CSRF token cookie.secure
(boolean secure) Specifies thesecure
flag of the CSRF token cookie.
-
Field Details
-
cookieName
The cookie name. -
headerName
The header name. -
parameterName
The parameter name. -
maxAge
The CSRF token cookie max age parameter. -
domain
The CSRF token cookie domain parameter. -
path
The CSRF token cookie path parameter. -
secure
The CSRF token cookie secure parameter. -
httpOnly
The CSRF token cookie httpOnly parameter.
-
-
Constructor Details
-
Builder
protected Builder()Creates a CSRF double submit cookie interceptor builder.
-
-
Method Details
-
cookieName
Specifies the name of the CSRF token cookie.
- Parameters:
cookieName
- a cookie name- Returns:
- this builder
-
headerName
Specifies the name of the CSRF token header.
- Parameters:
headerName
- a header name- Returns:
- this builder
-
parameterName
Specifies the name of the CSRF token parameter.
- Parameters:
parameterName
- a parameter name- Returns:
- this builder
-
maxAge
Specifies the max age of the CSRF token cookie.
- Parameters:
maxAge
- a max age in seconds- Returns:
- this builder
-
domain
Specifies the domain of the CSRF token cookie.
- Parameters:
domain
- a domain- Returns:
- this builder
-
path
Specifies the path of the CSRF token cookie.
- Parameters:
path
- a path- Returns:
- this builder
-
secure
Specifies the
secure
flag of the CSRF token cookie.If not specified, this is enabled by default which is the recommended behaviour.
- Parameters:
secure
- true to create a secured cookie, false otherwise- Returns:
- this builder
-
httpOnly
Specifies the
httpOnly
flag of the CSRF token cookie.If not specified, this is enabled by default which is the recommended behaviour.
You might need to set this to false when using JavaScript frameworks such as Angular, which requires to access the CSRF cookie token value in order to be able to send it in fetch calls in an HTTP header or a query parameter.
- Parameters:
httpOnly
- true to create an http only cookie, false otherwise- Returns:
- this builder
-
build
public <A extends ExchangeContext,B extends Exchange<A>> CSRFDoubleSubmitCookieInterceptor<A,B> build()Builds a CSRF double submit cookie interceptor.
- Type Parameters:
A
- the context typeB
- the exchange type- Returns:
- a CSRF double submit cookie interceptor
-