This API documentation is for Ballerina 1.2.0. View API documentation for the latest release.

Module : oauth2

Module Overview

This module provides an inbound OAuth2 authentication provider, which can be used to authenticate the provided credentials against an introspection endpoint and an outbound OAuth2 authentication provider, which can be used to authenticate an external endpoint.

For information on the operations, which you can perform with this module, see the below Functions. For examples on the usage of the operations, see the Secured Service with OAuth2 Example and Secured Client with OAuth2 Example.

Records

ClientCredentialsGrantConfig

The data structure, which is used to configure the OAuth2 client credentials grant type.

Detail

Record type to hold the details of an error.

DirectTokenConfig

The data structure, which is used to configure the OAuth2 access token directly.

DirectTokenRefreshConfig

The data structure, which can be used to pass the configurations for refreshing the access token directly.

InboundOAuth2CacheEntry Deprecated Represents cached OAuth2 information.
IntrospectionServerConfig

Represents introspection server onfigurations.

OutboundOAuth2CacheEntry

The data structure, which stores the values received from the authorization/token server to use them for the latter requests without requesting tokens again.

PasswordGrantConfig

The data structure, which is used to configure the OAuth2 password grant type.

RefreshConfig

The data structure, which can be used to pass the configurations for refreshing the access token of the password grant type.

Objects

InboundOAuth2Provider

Represents the inbound OAuth2 provider, which calls the introspection server, validates the received credentials, and performs authentication and authorization.

OutboundOAuth2Provider

Represents the outbound OAuth2 provider, which generates OAtuh2 tokens.

Functions

getScopes

Reads the scope(s) for the user with the given username.

Constants

OAUTH2_ERROR

Represents the OAuth2 error reason.

Errors

Error

Represents the OAuth2 error type with details.