Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class CsrfConfigurer
- Object
- SecurityConfigurer
- CsrfConfigurer
Protection against cross-site request forgery. On by default; see
CsrfFilter for what it requires of a request.
http.csrf(csrf -> csrf
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringRequestMatchers("/webhooks/**"));
A chain whose clients are not browsers – an API reached with a bearer token
or HTTP Basic from a program – has nothing to protect and turns it off:
http.csrf(csrf -> csrf.disable()).
Methods
public CsrfConfigurer csrfTokenRepository(CsrfTokenRepository csrfTokenRepository) | Where the token is kept; the session unless set. |
public CsrfConfigurer requireCsrfProtectionMatcher(RequestMatcher requireCsrfProtectionMatcher) | Which requests must carry the token; every one that is not a GET, HEAD, TRACE or OPTIONS unless set. |
public CsrfConfigurer ignoringRequestMatchers(String... patterns) | Requests left alone whatever their method, by Ant pattern: an endpoint another server calls, which authenticates some other way. |
public CsrfConfigurer ignoringRequestMatchers(RequestMatcher... requestMatchers) | Requests left alone whatever their method. |
public void configure(HttpSecurity http) | Adds this part’s filters; nothing by default. |
Inherited methods
Method details
csrfTokenRepository
public CsrfConfigurer csrfTokenRepository(CsrfTokenRepository csrfTokenRepository)Where the token is kept; the session unless set.
requireCsrfProtectionMatcher
public CsrfConfigurer requireCsrfProtectionMatcher(RequestMatcher requireCsrfProtectionMatcher)Which requests must carry the token; every one that is not a GET, HEAD,
TRACE or OPTIONS unless set.
ignoringRequestMatchers
public CsrfConfigurer ignoringRequestMatchers(String... patterns)Requests left alone whatever their method, by Ant pattern: an endpoint
another server calls, which authenticates some other way.
ignoringRequestMatchers
public CsrfConfigurer ignoringRequestMatchers(RequestMatcher... requestMatchers)Requests left alone whatever their method.
configure
public void configure(HttpSecurity http)Adds this part’s filters; nothing by default.