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

public interface SecurityFilter

Known subtypesAnonymousAuthenticationFilter, ApiKeyAuthenticationFilter, AuthorizationFilter, BasicAuthenticationFilter, BearerTokenAuthenticationFilter, CsrfFilter, DefaultLoginPageGeneratingFilter, ExceptionTranslationFilter, HeaderWriterFilter, LogoutFilter, OAuth2AuthorizationEndpointFilter, OAuth2AuthorizationRequestRedirectFilter, OAuth2AuthorizationServerFilter, OAuth2LoginAuthenticationFilter, RateLimitFilter, RememberMeAuthenticationFilter, SecondFactorAuthenticationFilter, SecurityContextHolderFilter, UsernamePasswordAuthenticationFilter, WebAuthnAuthenticationFilter, WebAuthnRegistrationFilter

One step of a SecurityFilterChain. A filter answers the request itself, or asks the rest of the chain and returns – or replaces – what comes back.

SecurityFilter audit = (request, chain) -> {
    log(request.getMethod() + " " + request.pathFrom(0));
    return chain.doFilter(request);
};
http.addFilterBefore(audit, AuthorizationFilter.class);

The response the chain returns may be one a handler shares between requests, so a filter does not write into it: a header for this request’s answer goes through SecurityExchange.setResponseHeader.

Methods

public abstract HttpServer.Response doFilter(HttpServer.Request request, FilterChain chain) throws ExceptionThe answer to request; null when nothing under the chain routes it, which the server answers 404.

Method details

doFilter

public abstract HttpServer.Response doFilter(HttpServer.Request request, FilterChain chain) throws Exception
The answer to request; null when nothing under the chain routes it, which the server answers 404.

Throws

Exception