import { FeathersError } from '@feathersjs/errors'; import { Application, Params } from '@feathersjs/feathers'; import { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication'; import { Storage } from './storage'; export type ClientConstructor = new (app: Application, options: AuthenticationClientOptions) => AuthenticationClient; export interface AuthenticationClientOptions { storage: Storage; header: string; scheme: string; storageKey: string; locationKey: string; locationErrorKey: string; jwtStrategy: string; path: string; Authentication: ClientConstructor; } export declare class AuthenticationClient { app: Application; authenticated: boolean; options: AuthenticationClientOptions; constructor(app: Application, options: AuthenticationClientOptions); get service(): import("@feathersjs/feathers").FeathersService, import("@feathersjs/feathers").Service, Params, Partial>>>; get storage(): Storage; handleSocket(socket: any): void; /** * Parse the access token or authentication error from the window location hash. Will remove it from the hash * if found. * * @param location The window location * @returns The access token if available, will throw an error if found, otherwise null */ getFromLocation(location: Location): Promise; /** * Set the access token in storage. * * @param accessToken The access token to set * @returns */ setAccessToken(accessToken: string): any; /** * Returns the access token from storage or the window location hash. * * @returns The access token from storage or location hash */ getAccessToken(): Promise; /** * Remove the access token from storage * @returns The removed access token */ removeAccessToken(): any; /** * Reset the internal authentication state. Usually not necessary to call directly. * * @returns null */ reset(): Promise; handleError(error: FeathersError, type: 'authenticate' | 'logout'): any; /** * Try to reauthenticate using the token from storage. Will do nothing if already authenticated unless * `force` is true. * * @param force force reauthentication with the server * @param strategy The name of the strategy to use. Defaults to `options.jwtStrategy` * @param authParams Additional authentication parameters * @returns The reauthentication result */ reAuthenticate(force?: boolean, strategy?: string, authParams?: Params): Promise; /** * Authenticate using a specific strategy and data. * * @param authentication The authentication data * @param params Additional parameters * @returns The authentication result */ authenticate(authentication?: AuthenticationRequest, params?: Params): Promise; /** * Log out the current user and remove their token. Will do nothing * if not authenticated. * * @returns The log out result. */ logout(): Promise; }