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

Object - oauth2 : InboundOAuth2Provider

Represents the inbound OAuth2 provider, which calls the introspection server, validates the received credentials, and performs authentication and authorization. The oauth2:InboundOAuth2Provider is an implementation of the auth:InboundAuthProvider interface.

 oauth2:IntrospectionServerConfig introspectionServerConfig = {
     url: "https://localhost:9196/oauth2/token/introspect"
 };
 oauth2:InboundOAuth2Provider inboundOAuth2Provider = new(introspectionServerConfig);

Constructor

__init

(IntrospectionServerConfig config)

Methods

Authenticates the provider OAuth2 tokens with an introspection endpoint.

Fields

  • introspectionClient Client
  • Introspection client endpoint

  • tokenTypeHint string?
  • A hint about the type of the token submitted for introspection

authenticate

(string credential)

returns boolean | Error

Authenticates the provider OAuth2 tokens with an introspection endpoint.

 boolean|auth:Error result = inboundOAuth2Provider.authenticate("<credential>");

Parameters

  • credential string
  • OAuth2 token to be authenticated

  • Return Type

    (boolean | Error)
  • true if authentication is successful, false otherwise, or else an auth:Error if an error occurred