io.vertx.ext.auth.oauth2

## Interface OAuth2Auth

- All Superinterfaces:
    AuthProvider

      public interface OAuth2Auth
      extends AuthProvider

  Factory interface for creating OAuth2 based `AuthProvider` instances.
  Author:
    Paulo Lopes

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `OAuth2Auth` | `api(HttpMethod method, String path, JsonObject params, Handler<AsyncResult<JsonObject>> handler)` Call OAuth2 APIs.
    `String` | `authorizeURL(JsonObject params)` Generate a redirect URL to the authN/Z backend.
    `static OAuth2Auth` | `create(Vertx vertx, OAuth2FlowType flow)` Create a OAuth2 auth provider
    `static OAuth2Auth` | `create(Vertx vertx, OAuth2FlowType flow, OAuth2ClientOptions config)` Create a OAuth2 auth provider
    `static OAuth2Auth` | `createKeycloak(Vertx vertx, OAuth2FlowType flow, JsonObject config)` Create a OAuth2 auth provider
    `void` | `getToken(JsonObject params, Handler<AsyncResult<AccessToken>> handler)` Returns the Access Token object.
    `boolean` | `hasJWTToken()` Returns true if this provider supports JWT tokens as the access_token.

    - ### Methods inherited from interface io.vertx.ext.auth.AuthProvider

      `authenticate`

- - ### Method Detail

    - #### createKeycloak

          static OAuth2Auth createKeycloak(Vertx vertx,
                                           OAuth2FlowType flow,
                                           JsonObject config)

      Create a OAuth2 auth provider
      Parameters:
        `vertx` - the Vertx instance
        `config` - the config as exported from the admin console
      Returns:
        the auth provider

    - #### create

          static OAuth2Auth create(Vertx vertx,
                                   OAuth2FlowType flow,
                                   OAuth2ClientOptions config)

      Create a OAuth2 auth provider
      Parameters:
        `vertx` - the Vertx instance
        `config` - the config
      Returns:
        the auth provider

    - #### create

          static OAuth2Auth create(Vertx vertx,
                                   OAuth2FlowType flow)

      Create a OAuth2 auth provider
      Parameters:
        `vertx` - the Vertx instance
      Returns:
        the auth provider

    - #### authorizeURL

          String authorizeURL(JsonObject params)

      Generate a redirect URL to the authN/Z backend. It only applies to auth_code flow.

    - #### getToken

          void getToken(JsonObject params,
                        Handler<AsyncResult<AccessToken>> handler)

      Returns the Access Token object.
      Parameters:
        `params` - - JSON with the options, each flow requires different options.
        `handler` - - The handler returning the results.

    - #### api

          OAuth2Auth api(HttpMethod method,
                         String path,
                         JsonObject params,
                         Handler<AsyncResult<JsonObject>> handler)

      Call OAuth2 APIs.
      Parameters:
        `method` - HttpMethod
        `path` - target path
        `params` - parameters
        `handler` - handler
      Returns:
        self

    - #### hasJWTToken

          boolean hasJWTToken()

      Returns true if this provider supports JWT tokens as the access_token. This is typically true if the provider implements the `openid-connect` protocol. This is a plain return from the config option jwtToken, which is false by default. This information is important to validate grants. Since pure OAuth2 should be used for authorization and when a token is requested all grants should be declared, in case of openid-connect this is not true. OpenId will issue a token and all grants will be encoded on the token itself so the requester does not need to list the required grants.
      Returns:
        true if openid-connect is used.

Copyright © 2016. All rights reserved.