Class AuthenticationConstraintHandler

  • All Implemented Interfaces:
    HttpHandler

    public class AuthenticationConstraintHandler
    extends java.lang.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 Detail

      • AuthenticationConstraintHandler

        public AuthenticationConstraintHandler​(HttpHandler next)
    • Method Detail

      • 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.