@adonisjs/auth
Version:
Official authentication provider for Adonis framework
76 lines (75 loc) • 2.25 kB
TypeScript
import { UserProviderContract, ProviderUserContract, GuardsList } from '@ioc:Adonis/Addons/Auth';
/**
* Base guard with shared abilities
*/
export declare abstract class BaseGuard<Guard extends keyof GuardsList> {
name: Guard;
config: GuardsList[Guard]['config'];
provider: UserProviderContract<any>;
constructor(name: Guard, config: GuardsList[Guard]['config'], provider: UserProviderContract<any>);
/**
* Reference to the name of the guard driver
*/
get driver(): "basic" | "session" | "oat";
/**
* Whether or not the authentication has been attempted
* for the current request
*/
authenticationAttempted: boolean;
/**
* Find if the user has been logged out in the current request
*/
isLoggedOut: boolean;
/**
* A boolean to know if user is retrieved by authenticating
* the current request or not
*/
isAuthenticated: boolean;
/**
* A boolean to know if user is loggedin via remember me token
* or not.
*/
viaRemember: boolean;
/**
* Logged in or authenticated user
*/
user?: any;
/**
* Accessor to know if user is logged in
*/
get isLoggedIn(): boolean;
/**
* Accessor to know if user is a guest. It is always opposite
* of [[isLoggedIn]]
*/
get isGuest(): boolean;
/**
* Lookup user using UID
*/
private lookupUsingUid;
/**
* Verify user password
*/
private verifyPassword;
/**
* Finds user by their id and returns the provider user instance
*/
protected findById(id: string | number): Promise<ProviderUserContract<any>>;
/**
* Returns the provider user instance from the regular user details. Raises
* exception when id is missing
*/
protected getUserForLogin(user: any, identifierKey: string): Promise<ProviderUserContract<any>>;
/**
* Marks user as logged-in
*/
protected markUserAsLoggedIn(user: any, authenticated?: boolean, viaRemember?: boolean): void;
/**
* Marks the user as logged out
*/
protected markUserAsLoggedOut(): void;
/**
* Verifies user credentials
*/
verifyCredentials(uid: string, password: string): Promise<any>;
}