UNPKG

@trimble-oss/trimble-id

Version:

Trimble Identity SDK for JavaScript/TypeScript

111 lines (110 loc) 4.63 kB
/** * Copyright (c) Trimble Inc. */ import { EndpointProvider } from '../interfaces/EndpointProvider'; /** * An endpoint provider that provides a fixed endpoint URL. * * FixedEndpointProvider helps to configure the fixed oauth endpoints like * authorization_endpoint, token_endpoint, userinfo_endpoint etc. * */ export default class FixedEndpointProvider implements EndpointProvider { private readonly _authorizationEndpoint; private readonly _tokenEndpoint; private readonly _userInfoEndpoint; private readonly _tokenRevocationEndpoint; private readonly _endSessionEndpoint; private readonly _jwksEndpoint; /** * Public constructor for FixedEndpointProvider class * * @param authorizationEndpoint - The URL for the Trimble Identity authorization endpoint * @param tokenEndpoint - The URL for the Trimble Identity token endpoint * @param userInfoEndpoint - The URL for the Trimble Identity user information endpoint * @param tokenRevocationEndpoint - The URL for the Trimble Identity token revocation endpoint, if not supplied this is computed relative to the token endpoint * @param jwksEndpoint - The URL for the Trimble Identity JSON web keyset endpoint * * @remarks All parameters for this constructor are considered obsolete. * Use fluent extensions when constructing a new instance in the future. */ constructor(authorizationEndpoint?: string | null, tokenEndpoint?: string | null, userInfoEndpoint?: string | null, tokenRevocationEndpoint?: string | null, jwksEndpoint?: string | null); /** * Add an authorization endpoint. * * @param authorizationEndpoint - The URL for the Trimble Identity authorization endpoint * @returns A new instance of a FixedEndpointProvider */ WithAuthorizationEndpoint(authorizationEndpoint: string): EndpointProvider; /** * Add a token endpoint. * * @param tokenEndpoint - The URL for the Trimble Identity token endpoint * @returns A new instance of a FixedEndpointProvider */ WithTokenEndpoint(tokenEndpoint: string): EndpointProvider; /** * Add a user info endpoint. * * @param userInfoEndpoint - The URL for the Trimble Identity user information endpoint * @returns A new instance of a FixedEndpointProvider */ WithUserInfoEndpoint(userInfoEndpoint: string): EndpointProvider; /** * Add a token revocation endpoint. * * @param tokenRevocationEndpoint - The URL for the Trimble Identity token revocation endpoint * @returns A new instance of a FixedEndpointProvider */ WithTokenRevocationEndpoint(tokenRevocationEndpoint: string): EndpointProvider; /** * Add an end session endpoint. * * @param endSessionEndpoint - The URL for the Trimble Identity end session endpoint, if not supplied this is computed relative to the token endpoint * @returns A new instance of a FixedEndpointProvider */ WithEndSessionEndpoint(endSessionEndpoint: string): EndpointProvider; /** * Add a JWKS endpoint. * * @param jwksEndpoint - The URL for the Trimble Identity JSON web keyset endpoint * @returns A new instance of a FixedEndpointProvider */ WithJWKSEndpoint(jwksEndpoint: string): EndpointProvider; /** * Retrieves a URL for the Trimble Identity authorization endpoint. * * @returns A Promise that resolves to the value of the URL on completion */ RetrieveAuthorizationEndpoint(): Promise<string>; /** * Retrieves the token endpoint URL. * * @returns Promise that resolves to the token endpoint URL */ RetrieveTokenEndpoint(): Promise<string>; /** * Retrieves a URL for the Trimble Identity user information endpoint. * * @returns A Promise that resolves to the value of the URL on completion */ 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 */ 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 */ RetrieveEndSessionEndpoint(): Promise<string>; /** * Retrieves a URL for the Trimble Identity JSON web keyset endpoint. * * @returns A Promise that resolves to the value of the URL on completion */ RetrieveJSONWebKeySetEndpoint(): Promise<string>; }