io.vertx.ext.web.handler

## Interface AuthorizationHandler

- All Superinterfaces:
    Handler<RoutingContext>

      public interface AuthorizationHandler
      extends Handler<RoutingContext>

  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`

  Author:
    Stephane Bastian

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `AuthorizationHandler` | `addAuthorizationProvider(AuthorizationProvider authorizationProvider)` Adds a provider that shall be used to retrieve the required authorizations for the user to attest.
    `static AuthorizationHandler` | `create(Authorization authorization)` create the 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`
    `AuthorizationHandler` | `variableConsumer(java.util.function.BiConsumer<RoutingContext,AuthorizationContext> handler)` Provide a simple handler to extract needed variables.

    - ### Methods inherited from interface io.vertx.core.Handler

      `handle`

- - ### Method Detail

    - #### create

          static AuthorizationHandler create(Authorization authorization)

      create the 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.

    - #### addAuthorizationProvider

          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.

    - #### variableConsumer

          AuthorizationHandler variableConsumer(java.util.function.BiConsumer<RoutingContext,AuthorizationContext> handler)

      Provide a simple handler to extract needed variables. As it may be useful to allow/deny access based on the value of a request param one can do: `(routingCtx, authCtx) -> authCtx.variables().addAll(routingCtx.request().params())` Or for example the remote address: `(routingCtx, authCtx) -> authCtx.result.variables().add(VARIABLE_REMOTE_IP, routingCtx.request().connection().remoteAddress())`
      Parameters:
        `handler` - a bi consumer.
      Returns:
        fluent self.

Copyright © 2022 Eclipse. All rights reserved.