Class: ListenerOAuth2Provider

Isolated

Represents the listener OAuth2 provider, which is used to validate the received credential (access token) by calling the configured OAuth2 introspection server.

1oauth2:IntrospectionConfig config = {
2 url: "https://localhost:9196/oauth2/token/introspect"
3};
4oauth2:ListenerOAuth2Provider provider = new(config);

Constructor

Provides authentication based on the provided introspection configurations.

init (IntrospectionConfig introspectionConfig)

Methods

authorize

Authenticates the provided OAuth2 acess token against the introspection endpoint.

authorize

function authorize(string credential, map<string>? optionalParams) returns IntrospectionResponse | Error
Isolated Function

Authenticates the provided OAuth2 acess token against the introspection endpoint.

1boolean result = check provider.authenticate("<credential>");

Parameters

  • credential string
  • OAuth2 access token to be authenticated

  • optionalParams map<string>? (default ())
  • Map of optional parameters used for the introspection endpoint

Return Type

(IntrospectionResponse | Error)

An oauth2:IntrospectionResponse if the authentication is successful or else an oauth2:Error if an error occurred