Class Security


  • public class Security
    extends Object
    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 Detail

      • __TYPE_ARG

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

      • Security

        public Security​(Security delegate)
      • Security

        public Security​(Object delegate)
    • Method Detail

      • hashCode

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

        public Security getDelegate()
      • 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,
                                           java.util.function.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​(java.util.function.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,
                                                          java.util.function.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,
                                                            java.util.function.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​(java.util.function.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​(java.util.function.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