matrix-react-sdk
Version:
SDK for matrix.org using React
57 lines (56 loc) • 2.43 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
/**
* @experimental
* Stores information about configured OIDC provider
*
* In OIDC Native mode the client is registered with OIDC directly and maintains an OIDC token.
*
* In OIDC Aware mode, the client is aware that the Server is using OIDC, but is using the standard Matrix APIs for most things.
* (Notable exceptions are account management, where a link to the account management endpoint will be provided instead.)
*
* Otherwise, the store is not operating. Auth is then in Legacy mode and everything uses normal Matrix APIs.
*/
export declare class OidcClientStore {
private readonly matrixClient;
private oidcClient?;
private initialisingOidcClientPromise;
private authenticatedIssuer?;
private _accountManagementEndpoint?;
/**
* Promise which resolves once this store is read to use, which may mean there is no OIDC client if we're in legacy mode,
* or we just have the account management endpoint if running in OIDC-aware mode.
*/
readonly readyPromise: Promise<void>;
constructor(matrixClient: MatrixClient);
private init;
/**
* True when the active user is authenticated via OIDC
*/
get isUserAuthenticatedWithOidc(): boolean;
private setAccountManagementEndpoint;
get accountManagementEndpoint(): string | undefined;
/**
* Revokes provided access and refresh tokens with the configured OIDC provider
* @param accessToken
* @param refreshToken
* @returns Promise that resolves when tokens have been revoked
* @throws when OidcClient cannot be initialised, or revoking either token fails
*/
revokeTokens(accessToken?: string, refreshToken?: string): Promise<void>;
/**
* Try to revoke a given token
* @param oidcClient
* @param token
* @param tokenType passed to revocation endpoint as token type hint
* @returns Promise that resolved with boolean whether the token revocation succeeded or not
*/
private tryRevokeToken;
private getOidcClient;
/**
* Tries to initialise an OidcClient using stored clientId and OIDC discovery.
* Assigns this.oidcClient and accountManagement endpoint.
* Logs errors and does not throw when oidc client cannot be initialised.
* @returns promise that resolves when initialising OidcClient succeeds or fails
*/
private initOidcClient;
}