# Class: OAuth2AuthHandler

## vertx-web-js/o_auth2_auth_handler~ OAuth2AuthHandler

#### new OAuth2AuthHandler()

An auth handler that provides OAuth2 Authentication support. This handler is suitable for AuthCode flows.

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 34

### Methods

#### addAuthorities(authorities) → {AuthHandler}

Add a set of required authorities for this auth handler

##### Parameters:

Name | Type | Description
--- | --- | ---
`authorities` | Array.<string> | the set of authorities

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 74

##### Returns:

a reference to this, so the API can be used fluently

Type
  AuthHandler

#### addAuthority(authority) → {AuthHandler}

Add a required authority for this auth handler

##### Parameters:

Name | Type | Description
--- | --- | ---
`authority` | string | the authority

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 59

##### Returns:

a reference to this, so the API can be used fluently

Type
  AuthHandler

#### authorize(user, handler)

Authorizes the given user against all added authorities.

##### Parameters:

Name | Type | Description
--- | --- | ---
`user` | User | a user.
`handler` | function | the handler for the result.

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 111

#### extraParams(extraParams) → {OAuth2AuthHandler}

Extra parameters needed to be passed while requesting a token.

##### Parameters:

Name | Type | Description
--- | --- | ---
`extraParams` | Object | extra optional parameters.

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 131

##### Returns:

self

Type
  OAuth2AuthHandler

#### handle(arg0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | RoutingContext |

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 45

#### parseCredentials(context, 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:

Name | Type | Description
--- | --- | ---
`context` | RoutingContext | the routing context
`handler` | function | the handler to be called once the information is available.

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 91

#### setupCallback(route) → {OAuth2AuthHandler}

add the callback handler to a given route.

##### Parameters:

Name | Type | Description
--- | --- | ---
`route` | Route | a given route e.g.: `/callback`

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 146

##### Returns:

self

Type
  OAuth2AuthHandler