Class Security

java.lang.Object
io.vertx.rxjava3.ext.web.openapi.router.Security
All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate

public class Security extends Object implements io.vertx.lang.rx.RxDelegate
An authentication handler factory. This class will hold factories for creating objects.

Handlers will be used when creating the router. This class will configure the handlers to some extent:

  • - api key handlers will be configured from the document to avoid setup mistakes
  • - nothing is required to be configured, they will be used as is
  • - nothing is required to be configured, they will be used as is
  • - nothing is required to be configured, they will be used as is. Note that for scopes you may need to configure the provider to locate the claims in the right place
  • can be used in two forms: oauth2 or openIdConnect. When using oauth2 the function will receive the openapi configuration and it is the function implementor responsibility to configure the handler correctly. For openIdConnect mode the asynchronous function can be used to use the discovery mechanism.
And extra note on callback. The callback is optional and if not provided the default behavior is to validate tokens as bearer tokens. When specified the callback must be an absolute path relative to the root of the router.

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

  • Field Details

    • __TYPE_ARG

      public static final io.vertx.lang.rx.TypeArg<Security> __TYPE_ARG
  • Constructor Details

    • Security

      public Security(Security delegate)
    • Security

      public Security(Object delegate)
  • Method Details

    • 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 Security getDelegate()
      Specified by:
      getDelegate in interface io.vertx.lang.rx.RxDelegate
    • apiKeyHandler

      public RouterBuilder apiKeyHandler(APIKeyHandler handler)
      Configure the to be used when creating the router.
      Parameters:
      handler - the handler to be used
      Returns:
      caller builder
    • httpHandler

      public RouterBuilder httpHandler(BasicAuthHandler handler)
      Configure the to be used when creating the router.
      Parameters:
      handler - the handler to be used
      Returns:
      caller builder
    • httpHandler

      public RouterBuilder httpHandler(DigestAuthHandler handler)
      Configure the to be used when creating the router.
      Parameters:
      handler - the handler to be used
      Returns:
      caller builder
    • httpHandler

      public RouterBuilder httpHandler(JWTAuthHandler handler)
      Configure the to be used when creating the router.
      Parameters:
      handler - the handler to be used
      Returns:
      caller builder
    • oauth2Handler

      public RouterBuilder oauth2Handler(String callback, Function<SecurityScheme, OAuth2AuthHandler> factory)
      Configure the to be used when creating the router.
      Parameters:
      callback - the callback path to be used to validate tokens
      factory - the handler factory that will receive the configuration and return the handler
      Returns:
      caller builder
    • oauth2Handler

      public RouterBuilder oauth2Handler(Function<SecurityScheme, OAuth2AuthHandler> factory)
      Configure the to be used when creating the router. In this mode the callback is not used and will not handle authorization_code flows.
      Parameters:
      factory - the handler factory that will receive the configuration and return the handler
      Returns:
      caller builder
    • openIdConnectHandler

      public Single<RouterBuilder> openIdConnectHandler(String callback, Function<String, Single<OAuth2AuthHandler>> factory)
      Configure the to be used when creating the router.
      Parameters:
      callback - the callback path to be used to validate tokens
      factory - the handler factory that will receive the openIdConnect discovery url and return the handler
      Returns:
      caller builder
    • rxOpenIdConnectHandler

      public Single<RouterBuilder> rxOpenIdConnectHandler(String callback, Function<String, Single<OAuth2AuthHandler>> factory)
      Configure the to be used when creating the router.
      Parameters:
      callback - the callback path to be used to validate tokens
      factory - the handler factory that will receive the openIdConnect discovery url and return the handler
      Returns:
      caller builder
    • openIdConnectHandler

      public Single<RouterBuilder> openIdConnectHandler(Function<String, Single<OAuth2AuthHandler>> factory)
      Configure the to be used when creating the router. In this mode the callback is not used and will not handle authorization_code flows.
      Parameters:
      factory - the handler factory that will receive the openIdConnect discovery url and return the handler
      Returns:
      caller builder
    • rxOpenIdConnectHandler

      public Single<RouterBuilder> rxOpenIdConnectHandler(Function<String, Single<OAuth2AuthHandler>> factory)
      Configure the to be used when creating the router. In this mode the callback is not used and will not handle authorization_code flows.
      Parameters:
      factory - the handler factory that will receive the openIdConnect discovery url and return the handler
      Returns:
      caller builder
    • newInstance

      public static Security newInstance(Security arg)