import { State } from '../shared/State'; import { CallbackHandler } from './CallbackOps'; import { JwkRsa } from './JoseOps'; import { type AccessTokenMetaType } from './OAuth2OidcOps'; export type Authenticate = { /** * Get tokens and store them in State * @param {boolean} forceLoginAsUser true to force login as user even if a service account is available (default: false) * @param {boolean} autoRefresh true to automatically refresh tokens before they expire (default: true) * @param {string[]} types Array of supported deployment types. The function will throw an error if an unsupported type is detected (default: ['classic', 'cloud', 'forgeops']) * @param {CallbackHandler} callbackHandler function allowing the library to collect responses from the user through callbacks * @returns {Promise} object containing the tokens */ getTokens(forceLoginAsUser?: boolean, autoRefresh?: boolean, types?: string[], callbackHandler?: CallbackHandler): Promise; /** * Get access token for service account * @param {string} saId optional service account id * @param {JwkRsa} saJwk optional service account JWK * @returns {string | null} Access token or null * @deprecated since v2.0.0 use {@link Authenticate.getTokens | getTokens} instead * ```javascript * getTokens(): Promise * ``` * @group Deprecated */ getAccessTokenForServiceAccount(saId?: string, saJwk?: JwkRsa): Promise; }; declare const _default: (state: State) => Authenticate; export default _default; export type UserSessionMetaType = { tokenId: string; successUrl: string; realm: string; expires: number; from_cache?: boolean; }; /** * Get fresh access token for service account * @param {State} state library state * @returns {Promise} response object containg token, scope, type, and expiration in seconds */ export declare function getFreshSaBearerToken({ saId, saJwk, state, }: { saId?: string; saJwk?: JwkRsa; state: State; }): Promise; /** * Get cached or fresh access token for service account * @param {State} state library state * @returns {Promise} response object containg token, scope, type, and expiration in seconds */ export declare function getSaBearerToken({ state, }: { state: State; }): Promise; export type Tokens = { bearerToken?: AccessTokenMetaType; userSessionToken?: UserSessionMetaType; subject?: string; host?: string; realm?: string; }; /** * Get tokens * @param {boolean} forceLoginAsUser true to force login as user even if a service account is available (default: false) * @param {boolean} autoRefresh true to automatically refresh tokens before they expire (default: true) * @param {State} state library state * @returns {Promise} object containing the tokens */ export declare function getTokens({ forceLoginAsUser, autoRefresh, types, callbackHandler, state, }: { forceLoginAsUser?: boolean; autoRefresh?: boolean; types?: string[]; callbackHandler?: CallbackHandler; state: State; }): Promise; //# sourceMappingURL=AuthenticateOps.d.ts.map