io.undertow.security.handlers

## Class AuthenticationConstraintHandler

- java.lang.Object
- - io.undertow.security.handlers.AuthenticationConstraintHandler

All Implemented Interfaces:
  HttpHandler

    public class AuthenticationConstraintHandler
    extends Object
    implements HttpHandler

Handler responsible for checking the constraints for the current request and marking authentication as required if applicable. Sub classes can override isAuthenticationRequired to provide a constraint check, by default this handler will set authentication as always required, authentication will be optional if this handler is omitted.

Author:
  Darran Lofthouse

### Constructor Summary

Constructors
Constructor and Description
`AuthenticationConstraintHandler(HttpHandler next)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`protected boolean` `isAuthenticationRequired(HttpServerExchange exchange)` Evaluate the current request and indicate if authentication is required for the current request.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AuthenticationConstraintHandler

    public AuthenticationConstraintHandler(HttpHandler next)

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`
See Also:
  `HttpHandler.handleRequest(io.undertow.server.HttpServerExchange)`

#### isAuthenticationRequired

    protected boolean isAuthenticationRequired(HttpServerExchange exchange)

Evaluate the current request and indicate if authentication is required for the current request. By default this will always return true, sub-classes will override this method to provide a more specific check.

Parameters:
  `exchange` - - the `HttpServerExchange` for the current request to decide if authentication is required.
Returns:
  true if authentication is required, false otherwise.