Package 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 Description AuthenticationConstraintHandler(HttpHandler next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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 interfaceHttpHandler
- 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
- - theHttpServerExchange
for the current request to decide if authentication is required.- Returns:
- true if authentication is required, false otherwise.
-
-