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

public interface CsrfToken

Known subtypesDefaultCsrfToken

The token a page sends back with a state-changing request to show the request came from the application’s own pages.

A controller receives the current one by declaring a parameter of this type, to put in a form or hand to a script:

@GetMapping("/csrf")
public Map csrf(CsrfToken token) {
    Map out = new LinkedHashMap();
    out.put("headerName", token.getHeaderName());
    out.put("token", token.getToken());
    return out;
}

Methods

public abstract String getHeaderName()The header a script sends the token in: X-CSRF-TOKEN.
public abstract String getParameterName()The form field a page sends the token in: _csrf.
public abstract String getToken()The value to send.

Method details

getHeaderName

public abstract String getHeaderName()
The header a script sends the token in: X-CSRF-TOKEN.

getParameterName

public abstract String getParameterName()
The form field a page sends the token in: _csrf.

getToken

public abstract String getToken()
The value to send. From a controller parameter it is masked: different in every response, and every one of them accepted.