@trimble-oss/trimble-id
Version:
Trimble Identity SDK for JavaScript/TypeScript
73 lines (72 loc) • 3 kB
TypeScript
/**
* Copyright (c) Trimble Inc.
*/
import { EndpointProvider } from '../interfaces/EndpointProvider';
/**
* OpenIdEndpointProvider helps to discover various endpoints like authorization_endpoint, token_endpoint, userinfo_endpoint etc.
*/
export default class OpenIdEndpointProvider implements EndpointProvider {
private readonly _configurationEndpoint;
private _authorizationEndpoint;
private _tokenEndpoint;
private _userInfoEndpoint;
private _jwksEndpoint;
private _tokenRevocationEndpoint;
private _endSessionEndpoint;
/**
* Public constructor for OpenIdEndpointProvider class
*
* @param configurationEndpoint The URL for the Trimble Identity OpenID well known configuration endpoint
* Production : https://id.trimble.com/.well-known/openid-configuration
* @param tokenRevocationEndpoint The URL for the Trimble Identity token revocation endpoint, if not supplied this is computed relative to the token endpoint
*/
constructor(configurationEndpoint: string, tokenRevocationEndpoint?: string | null);
/**
* Retrieves a URL for the Trimble Identity authorization endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveAuthorizationEndpoint(): Promise<string>;
/**
* Retrieves a URL for the Trimble Identity token endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveTokenEndpoint(): Promise<string>;
/**
* Retrieves a URL for the Trimble Identity user info endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveUserInfoEndpoint(): Promise<string>;
/**
* Retrieves a URL for the Trimble Identity token revocation endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveTokenRevocationEndpoint(): Promise<string>;
/**
* Retrieves a URL for the Trimble Identity end session endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveEndSessionEndpoint(): Promise<string>;
/**
* Retrieves a URL for the Trimble Identity JSON Web Key Set endpoint
*
* @returns A Promise that resolves to the value of the URL on completion
* @throws Thrown if the configuration endpoint returns an error
*/
RetrieveJSONWebKeySetEndpoint(): Promise<string>;
/**
* Internal method to load the OpenID configuration
*
* @returns Promise that resolves when configuration is loaded
*/
private _loadConfiguration;
}