Class AuthorizationHandler

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

public class AuthorizationHandler extends Object implements io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>, MutinyDelegate
Base interface for authorization handlers that provide authorization support.

AuthorizationHandlerImpl usually requires a AuthenticationHandler to be on the routing chain before it or a custom handler that has previously set a User in the RoutingContext

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

Author:
Stephane Bastian
See Also:
  • AuthorizationHandler
  • Field Details

  • Constructor Details

    • AuthorizationHandler

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

      public AuthorizationHandler(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 Consumer<RoutingContext>
    • handle

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

      public io.vertx.ext.web.handler.AuthorizationHandler 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 MutinyDelegate
      Returns:
      the delegate instance
    • create

      public static AuthorizationHandler create(Authorization authorization)
      create the handler that will check the specified authorization Note that to check several authorizations, you can specify a sub-interface such as AndAuthorization or OrAuthorization
      Parameters:
      authorization - the authorization to attest.
      Returns:
      fluent self.
    • create

      public static AuthorizationHandler create()
      create the handler that will check the attribute based authorization. In this mode, the required authorization is computed from the request itself or the metadata of the route. The important keys are:
      • X-ABAC-Domain - The domain of the permission, a domain is a the first segment of domain:operation
      • X-ABAC-Operation - The operation of the permission, the operation is a the second segment of domain:operation
      • X-ABAC-Resource - This is usually is a opaque string to mark the resource to access
      When any of these metadata values are missing they are replaced at runtime with their default values:
      • X-ABAC-Domain - Always web
      • X-ABAC-Operation - The request HTTP HttpMethod from HttpServerRequest#method()
      • X-ABAC-Resource - The normalized request path from RoutingContext.normalizedPath()
      Returns:
      fluent self.
    • addAuthorizationProvider

      public AuthorizationHandler addAuthorizationProvider(AuthorizationProvider authorizationProvider)
      Adds a provider that shall be used to retrieve the required authorizations for the user to attest. Multiple calls are allowed to retrieve authorizations from many sources.
      Parameters:
      authorizationProvider - a provider.
      Returns:
      fluent self.
    • newInstance

      public static AuthorizationHandler newInstance(io.vertx.ext.web.handler.AuthorizationHandler delegate)
      Creates a new instance of the AuthorizationHandler.
    • 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