UNPKG

@shane32/msoauth

Version:

A React library for Azure AD authentication with PKCE (Proof Key for Code Exchange) flow support. This library provides a secure and easy-to-use solution for implementing Azure AD authentication in React applications, with support for both API and Microso

37 lines (36 loc) 1.47 kB
import AuthManager from "./AuthManager"; /** * A proxy implementation of AuthManager that only handles provider selection * Used when multiple providers are configured but none is active */ declare class ProxyAuthManager<TPolicyNames extends string = string> extends AuthManager<TPolicyNames> { private providers; /** * Creates a new instance of ProxyAuthManager * @param {AuthManager[]} providers - The available auth providers * @param {string} [defaultProviderId] - The default provider ID * @throws {Error} If no providers are provided, if there are duplicate provider IDs, or if the default provider ID is invalid */ constructor(providers: AuthManager<TPolicyNames>[]); /** * Initiates the OAuth login flow with the specified provider * @throws {Error} This method is disabled in ProxyAuthManager */ login(): Promise<void>; /** * Handles the OAuth redirect callback * @throws {Error} This method is disabled in ProxyAuthManager */ handleRedirect(): Promise<void>; /** * When logged in, refreshes the access token if it's expired * Tries each provider until one successfully authenticates */ autoLogin(): Promise<void>; logout(path?: string): Promise<void>; localLogout(): void; getAccessToken(scopeSetName?: string): Promise<string>; isAuthenticated(): boolean; can(policy: TPolicyNames): boolean; } export default ProxyAuthManager;