Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class HttpSessionCsrfTokenRepository

  1. Object
  2. HttpSessionCsrfTokenRepository

ImplementsCsrfTokenRepository

Keeps the token in the HTTP session: the default. The token is sent to the page masked and must come back masked, in the X-CSRF-TOKEN header or the _csrf form field.

Constructors

public HttpSessionCsrfTokenRepository()

Methods

public void setHeaderName(String headerName)
public void setParameterName(String parameterName)
public CsrfToken generateToken(HttpServer.Request request)A new token, not yet stored.
public void saveToken(CsrfToken token, HttpServer.Request request)Stores token for the client; null forgets the stored one.
public CsrfToken loadToken(HttpServer.Request request)The stored token, or null when the client has none.

Inherited methods

Constructor details

HttpSessionCsrfTokenRepository

public HttpSessionCsrfTokenRepository()

Method details

setHeaderName

public void setHeaderName(String headerName)

setParameterName

public void setParameterName(String parameterName)

generateToken

public CsrfToken generateToken(HttpServer.Request request)
A new token, not yet stored.

saveToken

public void saveToken(CsrfToken token, HttpServer.Request request)
Stores token for the client; null forgets the stored one.

loadToken

public CsrfToken loadToken(HttpServer.Request request)
The stored token, or null when the client has none.