Class: ListenerOAuth2Provider
Isolated
Represents the listener OAuth2 provider, which is used to validate the received credential (access token) by calling the configured introspection endpoint.
1oauth2:IntrospectionConfig config = {2 url: "https://localhost:9196/oauth2/token/introspect"3};4oauth2:ListenerOAuth2Provider provider = new(config);
Constructor
Provides authorization based on the provided introspection configurations.
init (IntrospectionConfig introspectionConfig)
- introspectionConfig IntrospectionConfig
Introspection endpoint configurations
Methods
authorize | Validates the provided OAuth2 acess token against the introspection endpoint. |
authorize
function authorize(string credential, map<string>? optionalParams) returns IntrospectionResponse | Error
Isolated Function
Validates the provided OAuth2 acess token against the introspection endpoint.
1boolean result = check provider.authorize("<credential>");
Parameters
- credential string
OAuth2 access token to be validated
Return Type
(IntrospectionResponse | Error)An oauth2:IntrospectionResponse
if the validation is successful or else an oauth2:Error
if an error occurred