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

public final class ExceptionHandlingConfigurer

  1. Object
  2. SecurityConfigurer
  3. ExceptionHandlingConfigurer

How a chain answers a request that must sign in, and one that may not have what it asked for.

http.exceptionHandling(handling -> handling
        .authenticationEntryPoint(new HttpStatusEntryPoint(401))
        .accessDeniedHandler((request, denied) ->
                HttpServer.Response.json(403, "{\"error\":\"forbidden\"}")));

Without an entry point set here, form login’s is the answer – a redirect to the login page – and HTTP Basic’s challenge when that is the only way in, or when a script made the request. A chain with neither answers 403.

Methods

public ExceptionHandlingConfigurer authenticationEntryPoint(AuthenticationEntryPoint entryPoint)The entry point for every request under the chain.
public ExceptionHandlingConfigurer accessDeniedHandler(AccessDeniedHandler handler)What answers a signed-in caller that is denied; a 403 unless set.
public ExceptionHandlingConfigurer defaultAuthenticationEntryPointFor(AuthenticationEntryPoint entryPoint, RequestMatcher preferredMatcher)An entry point for the requests preferredMatcher matches, used when no single entry point is set.
public ExceptionHandlingConfigurer defaultAccessDeniedHandlerFor(AccessDeniedHandler handler, RequestMatcher preferredMatcher)A handler for the denied requests preferredMatcher matches, used when no single handler is set.
public void configure(HttpSecurity http)Adds this part’s filters; nothing by default.

Inherited methods

Method details

authenticationEntryPoint

public ExceptionHandlingConfigurer authenticationEntryPoint(AuthenticationEntryPoint entryPoint)
The entry point for every request under the chain.

accessDeniedHandler

public ExceptionHandlingConfigurer accessDeniedHandler(AccessDeniedHandler handler)
What answers a signed-in caller that is denied; a 403 unless set.

defaultAuthenticationEntryPointFor

public ExceptionHandlingConfigurer defaultAuthenticationEntryPointFor(AuthenticationEntryPoint entryPoint, RequestMatcher preferredMatcher)
An entry point for the requests preferredMatcher matches, used when no single entry point is set. The first one added also answers the requests none of them matches.

defaultAccessDeniedHandlerFor

public ExceptionHandlingConfigurer defaultAccessDeniedHandlerFor(AccessDeniedHandler handler, RequestMatcher preferredMatcher)
A handler for the denied requests preferredMatcher matches, used when no single handler is set. A denied request none of them matches is answered 403.

configure

public void configure(HttpSecurity http)
Adds this part’s filters; nothing by default.