UNPKG

@datalayer/core

Version:

[![Datalayer](https://assets.datalayer.tech/datalayer-25.svg)](https://datalayer.io)

55 lines (54 loc) 1.94 kB
import type { AuthStrategy, AuthOptions, AuthResult, TokenStorage } from './types'; import { UserDTO } from '../../models/UserDTO'; /** * Base authentication strategy with common functionality */ declare abstract class BaseAuthStrategy implements AuthStrategy { protected iamRunUrl: string; protected storage?: TokenStorage | undefined; constructor(iamRunUrl: string, storage?: TokenStorage | undefined); abstract authenticate(options: AuthOptions): Promise<AuthResult>; abstract canHandle(options: AuthOptions): boolean; /** * Validate a token by calling whoami */ protected validateToken(token: string): Promise<UserDTO>; } /** * Token-based authentication strategy * Authenticates using an existing token */ export declare class TokenAuthStrategy extends BaseAuthStrategy { canHandle(options: AuthOptions): boolean; authenticate(options: AuthOptions): Promise<AuthResult>; } /** * Credentials-based authentication strategy * Authenticates using handle and password */ export declare class CredentialsAuthStrategy extends BaseAuthStrategy { canHandle(options: AuthOptions): boolean; authenticate(options: AuthOptions): Promise<AuthResult>; } /** * Storage-based authentication strategy * Authenticates using a token from storage */ export declare class StorageAuthStrategy extends BaseAuthStrategy { canHandle(options: AuthOptions): boolean; authenticate(options: AuthOptions): Promise<AuthResult>; } /** * Browser OAuth strategy * Authenticates using browser-based OAuth flow with GitHub or LinkedIn */ export declare class BrowserOAuthStrategy extends BaseAuthStrategy { canHandle(options: AuthOptions): boolean; authenticate(options: AuthOptions): Promise<AuthResult>; /** * Wait for OAuth callback in popup window * Expects: { user, token, error } from the Datalayer OAuth callback */ private waitForOAuthCallback; } export {};