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

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

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

An authentication error interceptor that implements RFC 7235 HTTP authentication.

As per RFC 7235, this interceptor sends a challenge to the requester in the www-authenticate HTTP header on an UNAUTHORIZED(401) error.

Since:
1.5
Author:
Jeremy Kuhn
  • Constructor Details

    • HttpAuthenticationErrorInterceptor

      public HttpAuthenticationErrorInterceptor()
  • Method Details

    • interceptUnauthorized

      protected void interceptUnauthorized(B exchange) throws io.inverno.mod.http.base.HttpException
      Description copied from class: AuthenticationErrorInterceptor

      Intercepts an unauthorized exchange.

      Specified by:
      interceptUnauthorized in class AuthenticationErrorInterceptor<A extends io.inverno.mod.http.base.ExchangeContext,B extends ErrorExchange<A>>
      Parameters:
      exchange - the unauthorized exchange to intercept
      Throws:
      io.inverno.mod.http.base.HttpException - if there was an error intercepting the exchange
    • createChallenge

      protected abstract String createChallenge(SecurityException cause)

      Creates the challenge to send to the requester.

      Parameters:
      cause - the cause of the error (can be null)
      Returns:
      a challenge