UNPKG

search-client

Version:

Javascript library for executing searches in the Haive search-index via the SearchManager REST interface.

39 lines (38 loc) 2.13 kB
import { BaseCall, Fetch, Query } from '../Common'; import { IAuthentication } from './Authentication'; import { IAuthenticationSettings } from './AuthenticationSettings'; import { AuthToken } from './AuthToken'; /** * The JwtAuthentication service is a supporting feature for the other services. * Typically used via the [[SearchClient.constructor]] and by providing [[AuthenticationSettings]] settings in * the [[Settings.authentication]] property. * * The authentication system is based on JWT and needs an end-point to be configured from where it will get its * authentication-token. This service will be monitoring the token-value to see if it is either missing or * expired. When that happens a new token will be fetched from the end-point. The [[AuthenticationSettings.expiryOverlap]] * object controls how long before expiration the new token is to be fetched. */ export declare class JwtAuthentication extends BaseCall<any> implements IAuthentication { settings: IAuthenticationSettings; /** * Creates an JwtAuthentication object that knows where to get the auth-token and when to refresh it. * @param settings - The settings for the authentication object. * @param auth - An object that controls the authentication for the lookups. */ constructor(settings: IAuthenticationSettings | string, auth?: AuthToken, fetchMethod?: Fetch); /** * Call the service, but take into account deferredUpdates. * * @param query The query object to create the fetch for. * @param delay A delay for when to execute the update, in milliseconds. Defaults to undefined. */ update(query: Query, delay?: number): void; /** * Fetches the authentication-token from the server. * @param query - For the Authentication service this parameter is ignored. * @param suppressCallbacks - Set to true if you have defined callbacks, but somehow don't want them to be called. * @returns a promise that when resolved returns a jwt token. */ protected fetchInternal(query?: Query, suppressCallbacks?: boolean): Promise<string>; private setupRefresh; }