io.vertx.ext.web.handler

## Interface AuthHandler

- All Superinterfaces:
    Handler<RoutingContext>
  All Known Subinterfaces:
    BasicAuthHandler, ChainAuthHandler, DigestAuthHandler, JWTAuthHandler, OAuth2AuthHandler, RedirectAuthHandler

      public interface AuthHandler
      extends Handler<RoutingContext>

  Base interface for auth handlers.

  An auth handler allows your application to provide authentication/authorization support.

  Auth handler requires a `SessionHandler` to be on the routing chain before it.

  Author:
    Tim Fox, Paulo Lopes

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `AuthHandler` | `addAuthorities(Set<String> authorities)` Add a set of required authorities for this auth handler
    `AuthHandler` | `addAuthority(String authority)` Add a required authority for this auth handler
    `void` | `authorize(User user, Handler<AsyncResult<Void>> handler)` Authorizes the given user against all added authorities.
    `void` | `parseCredentials(RoutingContext context, Handler<AsyncResult<JsonObject>> handler)` Parses the credentials from the request into a JsonObject.

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

      `handle`

- - ### Method Detail

    - #### addAuthority

          AuthHandler addAuthority(String authority)

      Add a required authority for this auth handler
      Parameters:
        `authority` - the authority
      Returns:
        a reference to this, so the API can be used fluently

    - #### addAuthorities

          AuthHandler addAuthorities(Set<String> authorities)

      Add a set of required authorities for this auth handler
      Parameters:
        `authorities` - the set of authorities
      Returns:
        a reference to this, so the API can be used fluently

    - #### parseCredentials

          void parseCredentials(RoutingContext context,
                                Handler<AsyncResult<JsonObject>> handler)

      Parses the credentials from the request into a JsonObject. The implementation should be able to extract the required info for the auth provider in the format the provider expects.
      Parameters:
        `context` - the routing context
        `handler` - the handler to be called once the information is available.

    - #### authorize

          void authorize(User user,
                         Handler<AsyncResult<Void>> handler)

      Authorizes the given user against all added authorities.
      Parameters:
        `user` - a user.
        `handler` - the handler for the result.

Copyright © 2022 Eclipse. All rights reserved.