Module io.inverno.mod.security.http
Package io.inverno.mod.security.http
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 typeB- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanFlag indicating whether the interceptor should claim the exchange (i.e. terminates the exchange by returning an empty response). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a non-terminating authentication error interceptor.protectedAuthenticationErrorInterceptor(boolean terminal) Creates an authentication error interceptor. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<? extends B> protected abstract voidinterceptUnauthorized(B exchange) Intercepts an unauthorized exchange.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
- Specified by:
interceptin interfaceExchangeInterceptor<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
-