import AuthProvider from '../provider'; import type { IAuthenticationResult, ICredentials } from '../provider'; import type { IHttpRequest, IHttpResponse } from '../../http'; interface IHttpBodyKeys { accessToken: string; refreshToken: string; login: string; password: string; refreshTokenInRequestBody: string; } interface IHttpEndpoints { authenticate: string; refresh: string; logout: string; } export default class HttpTokenAuthProvider extends AuthProvider { protected httpBodyKeys: IHttpBodyKeys; protected httpEndpoints: IHttpEndpoints; /** * Set endpoint URL's for authentication, refreshing and logout. * @param endpoints key mappings */ setHttpEndpoints(endpoints: Partial): void; /** * Set object keys for request/response body used as user name, password, access token and remember token. * @param keys key mappings */ setHttpBodyKeys(keys: Partial): void; private authResponse; authenticate(credentials: ICredentials): Promise; authorizeRequest(req: IHttpRequest, token: string): void; isRequestRecoverable({ req, res }: { req: IHttpRequest; res: IHttpResponse | null; }): boolean; protected recoverAccessToken(refreshToken: string): Promise; logout(): Promise; } export {};