45 lines
2.0 KiB
TypeScript
45 lines
2.0 KiB
TypeScript
import { Tunnel } from '@microsoft/dev-tunnels-contracts';
|
|
/**
|
|
* Supports parsing tunnel access token JWT properties to allow for some pre-validation
|
|
* and diagnostics.
|
|
*
|
|
* Applications generally should not attempt to interpret or rely on any token properties
|
|
* other than `expiration`, because the service may change or omit those claims in the future.
|
|
* Other claims are exposed here only for diagnostic purposes.
|
|
*/
|
|
export declare class TunnelAccessTokenProperties {
|
|
readonly clusterId?: string | undefined;
|
|
readonly tunnelId?: string | undefined;
|
|
readonly tunnelPorts?: number[] | undefined;
|
|
readonly scopes?: string[] | undefined;
|
|
readonly issuer?: string | undefined;
|
|
readonly expiration?: Date | undefined;
|
|
private constructor();
|
|
toString(): string;
|
|
/**
|
|
* Checks if the tunnel access token expiration claim is in the past.
|
|
*
|
|
* (Does not throw if the token is an invalid format.)
|
|
*/
|
|
static validateTokenExpiration(token: string): void;
|
|
/**
|
|
* Attempts to parse a tunnel access token (JWT). This does NOT validate the token
|
|
* signature or any claims.
|
|
*/
|
|
static tryParse(token: string): TunnelAccessTokenProperties | null;
|
|
/**
|
|
* Gets the tunnal access token trace string.
|
|
* 'none' if null or undefined, parsed token info if can be parsed, or 'token' if cannot be parsed.
|
|
*/
|
|
static getTokenTrace(token?: string | null | undefined): string;
|
|
/**
|
|
* Gets a tunnel access token that matches any of the provided access token scopes.
|
|
* Validates token expiration if the token is found and throws an error if it's expired.
|
|
* @param tunnel The tunnel to get the access tokens from.
|
|
* @param accessTokenScopes What scopes the token needs to have.
|
|
* @returns Tunnel access token if found; otherwise, undefined.
|
|
*/
|
|
static getTunnelAccessToken(tunnel?: Tunnel | null, accessTokenScopes?: string | string[]): string | undefined;
|
|
private static base64UrlDecode;
|
|
}
|
|
//# sourceMappingURL=tunnelAccessTokenProperties.d.ts.map
|