@c8y/bootstrap
Version:
Bootstrap layer
28 lines (27 loc) • 1.66 kB
TypeScript
import type { BasicAuth, BearerAuthFromSessionStorage, Client, CookieAuth, IApplication, IAuthentication, ICurrentTenant, ICurrentUser, IUser } from '@c8y/client';
export declare const TOKEN_KEY = "_tcy8";
export declare const TFATOKEN_KEY = "TFAToken";
export declare const queryParamsThatRequireRedirectToLoginApp: readonly ["email", "token", "code", "session_state", "error", "error_description"];
export declare function loadManifest(client: Client, options?: Record<string, any>): Promise<IApplication>;
export declare function addCssClassesForApp(app: IApplication): void;
export declare function addCssVariablesForApp(app: IApplication): void;
export declare function redirectToLoginApp(options?: Record<string, any>): void;
/**
* Redirects to the login application in case the user is not logged in.
*/
export declare function ensureLoggedInIfRequired(options?: Record<string, any>): Promise<false | {
client: Client;
currentUser: IUser | ICurrentUser;
currentApp: IApplication;
currentTenant: ICurrentTenant;
}>;
export declare function isLocal(): boolean;
export declare function getCurrentContextPath(options?: Record<string, any>): string | undefined;
export declare function getCurrentUser(): Promise<{
client: Client;
currentUser: IUser | ICurrentUser;
}>;
export declare function pickAuthStrategy(bearer: typeof BearerAuthFromSessionStorage, basic: typeof BasicAuth, cookie: typeof CookieAuth): BearerAuthFromSessionStorage | BasicAuth | CookieAuth;
export declare function getAuthStrategy(): Promise<IAuthentication>;
export declare function getStoredToken(): string;
export declare function getStoredTfaToken(): string;