Class SimpleAuthenticationHandler

    • Constructor Detail

      • SimpleAuthenticationHandler

        public SimpleAuthenticationHandler​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static SimpleAuthenticationHandler create()
        Creates a new instance of the simple authentication handler.
        Returns:
        a new instance.
      • authenticate

        public SimpleAuthenticationHandler authenticate​(java.util.function.Function<RoutingContext,​Future<User>> authenticationFunction)
        This function will allow you to perform authentication the way you intended to. The process should be self explanatory, for example if the request contains a given property completing the function with a non null object is enough to allow the handler to continue. In order to signal errors, you should not call or . Errors should be signaled using the HttpException type. Any other kind of errors will be wrapped as a 401 error. For example forbidden access should be signaled with: new HttpException(403). This is required when working with ChainAuthHandler. By using exceptions to signal failures instead of immediately terminating the request, it allows the chain to proceed to the next handler if needed.
        Parameters:
        authenticationFunction - the authentication function.
        Returns:
        self
      • authenticate

        public SimpleAuthenticationHandler authenticate​(Function<RoutingContext,​Single<User>> authenticationFunction)
        This function will allow you to perform authentication the way you intended to. The process should be self explanatory, for example if the request contains a given property completing the function with a non null object is enough to allow the handler to continue. In order to signal errors, you should not call or . Errors should be signaled using the HttpException type. Any other kind of errors will be wrapped as a 401 error. For example forbidden access should be signaled with: new HttpException(403). This is required when working with ChainAuthHandler. By using exceptions to signal failures instead of immediately terminating the request, it allows the chain to proceed to the next handler if needed.
        Parameters:
        authenticationFunction - the authentication function.
        Returns:
        self