io.vertx.reactivex.ext.web.handler

## Class SimpleAuthenticationHandler

- java.lang.Object
- - io.vertx.reactivex.ext.web.handler.SimpleAuthenticationHandler

- All Implemented Interfaces:
    Handler<RoutingContext>, AuthenticationHandler

      public class SimpleAuthenticationHandler
      extends Object
      implements AuthenticationHandler, Handler<RoutingContext>

  A user customizable authentication handler.

  An auth handler allows your application to provide authentication support. The handler is not fully functional without a authentication function. This function takes the as input and returns a . The future should return a non `null` user object. In the `authenticate(java.util.function.Function<io.vertx.reactivex.ext.web.RoutingContext, io.vertx.core.Future<io.vertx.reactivex.ext.auth.User>>)` you have full control on the request, so all operations like redirect, next, fail are allowed. There are some rules that need to be followed in order to allow this handler to properly interop with `ChainAuthHandler`.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<SimpleAuthenticationHandler>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleAuthenticationHandler(Object delegate)`
    `SimpleAuthenticationHandler(SimpleAuthenticationHandler delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SimpleAuthenticationHandler` | `authenticate(java.util.function.Function<RoutingContext,Future<User>> authenticationFunction)` This function will allow you to perform authentication the way you intended to.
    `SimpleAuthenticationHandler` | `authenticate(Function<RoutingContext,Single<User>> authenticationFunction)` This function will allow you to perform authentication the way you intended to.
    `static SimpleAuthenticationHandler` | `create()` Creates a new instance of the simple authentication handler.
    `boolean` | `equals(Object o)`
    `SimpleAuthenticationHandler` | `getDelegate()`
    `void` | `handle(RoutingContext event)` Something has happened, so handle it.
    `int` | `hashCode()`
    `static SimpleAuthenticationHandler` | `newInstance(SimpleAuthenticationHandler arg)`
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.reactivex.ext.web.handler.AuthenticationHandler

      `newInstance`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<SimpleAuthenticationHandler> __TYPE_ARG

  - ### Constructor Detail

    - #### SimpleAuthenticationHandler

          public SimpleAuthenticationHandler(SimpleAuthenticationHandler delegate)

    - #### SimpleAuthenticationHandler

          public SimpleAuthenticationHandler(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public SimpleAuthenticationHandler getDelegate()

      Specified by:
        `getDelegate` in interface `AuthenticationHandler`

    - #### handle

          public void handle(RoutingContext event)

      Something has happened, so handle it.
      Specified by:
        `handle` in interface `Handler<RoutingContext>`
      Specified by:
        `handle` in interface `AuthenticationHandler`
      Parameters:
        `event` - the event to handle

    - #### 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

    - #### newInstance

          public static SimpleAuthenticationHandler newInstance(SimpleAuthenticationHandler arg)

Copyright © 2023 Eclipse. All rights reserved.