Class AuthenticationErrorInterceptor<A extends io.inverno.mod.http.base.ExchangeContext,B extends ErrorExchange<A>>

java.lang.Object
io.inverno.mod.security.http.AuthenticationErrorInterceptor<A,B>
Type Parameters:
A - the context type
B - the error echange type
All Implemented Interfaces:
ExchangeInterceptor<A,B>
Direct Known Subclasses:
FormAuthenticationErrorInterceptor, HttpAuthenticationErrorInterceptor

public abstract class AuthenticationErrorInterceptor<A extends io.inverno.mod.http.base.ExchangeContext,B extends ErrorExchange<A>> extends Object implements ExchangeInterceptor<A,B>

Base implemenation for authentication error interceptors.

An authentication error interceptor intercepts UNAUTHORIZED(401) errors in order to provide authentication instructions to the requester in the error response. Such interceptor is typically used to initiate the authentication process with the requester.

Since:
1.5
Author:
Jeremy Kuhn
  • Field Details

    • terminal

      protected final boolean terminal
      Flag indicating whether the interceptor should claim the exchange (i.e. terminates the exchange by returning an empty response).
  • Constructor Details

    • AuthenticationErrorInterceptor

      protected AuthenticationErrorInterceptor()

      Creates a non-terminating authentication error interceptor.

    • AuthenticationErrorInterceptor

      protected AuthenticationErrorInterceptor(boolean terminal)

      Creates an authentication error interceptor.

      If terminal, the interceptor claims the exchange and return an empty response resulting in no further processing.

      Parameters:
      terminal - true to terminate the exchange, false otherwise
  • Method Details

    • intercept

      public reactor.core.publisher.Mono<? extends B> intercept(B exchange)
      Specified by:
      intercept in interface ExchangeInterceptor<A extends io.inverno.mod.http.base.ExchangeContext,B extends ErrorExchange<A>>
    • interceptUnauthorized

      protected abstract void interceptUnauthorized(B exchange) throws io.inverno.mod.http.base.HttpException

      Intercepts an unauthorized exchange.

      Parameters:
      exchange - the unauthorized exchange to intercept
      Throws:
      io.inverno.mod.http.base.HttpException - if there was an error intercepting the exchange