@adonisjs/auth
Version:
Official authentication provider for Adonis framework
51 lines (50 loc) • 1.55 kB
TypeScript
import { OATGuardConfig, OATLoginOptions, OATClientContract, UserProviderContract, ClientRequestData } from '@ioc:Adonis/Addons/Auth';
import { TokenProviderContract } from '@ioc:Adonis/Addons/Auth';
/**
* OAT client to login a user during tests using the
* opaque tokens guard
*/
export declare class OATClient implements OATClientContract<any> {
name: string;
config: OATGuardConfig<any>;
private provider;
tokenProvider: TokenProviderContract;
constructor(name: string, config: OATGuardConfig<any>, provider: UserProviderContract<any>, tokenProvider: TokenProviderContract);
/**
* Token generated during the login call
*/
private tokenId?;
/**
* Length of the raw token. The hash length will vary
*/
private tokenLength;
/**
* Token type for the persistance store
*/
private tokenType;
/**
* Returns the provider user instance from the regular user details. Raises
* exception when id is missing
*/
private getUserForLogin;
/**
* Converts value to a sha256 hash
*/
private generateHash;
/**
* Converts expiry duration to an absolute date/time value
*/
private getExpiresAtDate;
/**
* Generates a new token + hash for the persistance
*/
private generateTokenForPersistance;
/**
* Returns the request data to mark user as logged in
*/
login(user: any, options?: OATLoginOptions): Promise<ClientRequestData>;
/**
* Logout user
*/
logout(): Promise<void>;
}