Module io.inverno.mod.security.http
Package io.inverno.mod.security.http
Class AuthenticationErrorInterceptor<A extends ExchangeContext,B extends ErrorExchange<A>>
java.lang.Object
io.inverno.mod.security.http.AuthenticationErrorInterceptor<A,B>
- Type Parameters:
A
- the context typeB
- the error echange type
- All Implemented Interfaces:
ExchangeInterceptor<A,
B>
- Direct Known Subclasses:
FormAuthenticationErrorInterceptor
,HttpAuthenticationErrorInterceptor
public abstract class AuthenticationErrorInterceptor<A extends 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 Summary
Modifier and TypeFieldDescriptionprotected final boolean
Flag indicating whether the interceptor should claim the exchange (i.e. terminates the exchange by returning an empty response). -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a non-terminating authentication error interceptor.protected
AuthenticationErrorInterceptor
(boolean terminal) Creates an authentication error interceptor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.http.server.ExchangeInterceptor
andThen, compose
-
Field Details
-
terminal
protected final boolean terminalFlag 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
Description copied from interface:ExchangeInterceptor
Intercepts the exchange before the exchange handler is invoked.
- Specified by:
intercept
in interfaceExchangeInterceptor<A extends ExchangeContext,
B extends ErrorExchange<A>> - Parameters:
exchange
- the server exchange to handle- Returns:
- a Mono emitting the exchange or an instrumented exchange to continue the exchange handling chain or an empty Mono to stop the exchange handling chain
-
interceptUnauthorized
Intercepts an unauthorized exchange.
- Parameters:
exchange
- the unauthorized exchange to intercept- Throws:
HttpException
- if there was an error intercepting the exchange
-