Class APIKeyHandler

java.lang.Object
io.vertx.mutiny.ext.web.handler.APIKeyHandler
All Implemented Interfaces:
MutinyDelegate, io.vertx.core.Handler<RoutingContext>, AuthenticationHandler, Consumer<RoutingContext>

public class APIKeyHandler extends Object implements AuthenticationHandler, io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>, MutinyDelegate
An authentication handler that provides API Key support. API keys can be extracted from HTTP headers/query parameters/cookies. By default this handler will extract the API key from an HTTP header named X-API-KEY.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Paulo Lopes
See Also:
  • APIKeyHandler
  • Field Details

  • Constructor Details

    • APIKeyHandler

      public APIKeyHandler(io.vertx.ext.web.handler.APIKeyHandler delegate)
      Create a new instance of APIKeyHandler delegating to the given (non-null) instance of APIKeyHandler.
    • APIKeyHandler

      public APIKeyHandler(Object delegate)
  • Method Details

    • accept

      public void accept(RoutingContext item)
      Handle an item. This method is generated from the original method."
      Specified by:
      accept in interface AuthenticationHandler
      Specified by:
      accept in interface Consumer<RoutingContext>
    • handle

      public void handle(RoutingContext item)
      Handle an item. This method is generated from the original method."
      Specified by:
      handle in interface AuthenticationHandler
      Specified by:
      handle in interface io.vertx.core.Handler<RoutingContext>
    • getDelegate

      public io.vertx.ext.web.handler.APIKeyHandler getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface AuthenticationHandler
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • create

      public static APIKeyHandler create(AuthenticationProvider authProvider)
      Create an API Key authentication handler
      Parameters:
      authProvider - the auth provider to use
      Returns:
      the auth handler
    • header

      public APIKeyHandler header(String headerName)
      Specify the source for the api key extraction as an HTTP header with the given name.
      Parameters:
      headerName - the header name containing the API key
      Returns:
      fluent self
    • parameter

      public APIKeyHandler parameter(String paramName)
      Specify the source for the api key extraction as an HTTP query parameter with the given name.
      Parameters:
      paramName - the parameter name containing the API key
      Returns:
      fluent self
    • cookie

      public APIKeyHandler cookie(String cookieName)
      Specify the source for the api key extraction as an HTTP cookie with the given name.
      Parameters:
      cookieName - the cookie name containing the API key
      Returns:
      fluent self
    • tokenExtractor

      public APIKeyHandler tokenExtractor(Function<String,io.smallrye.mutiny.Uni<String>> tokenExtractor)
      Transform from user's token format to the AuthenticationHandler's format.
      Parameters:
      tokenExtractor - extract the token from the origin payload
      Returns:
      fluent self
    • newInstance

      public static APIKeyHandler newInstance(io.vertx.ext.web.handler.APIKeyHandler delegate)
      Creates a new instance of the APIKeyHandler.
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object