@adonisjs/auth
Version:
Official authentication provider for Adonis framework
73 lines (72 loc) • 2.53 kB
TypeScript
/// <reference types="@adonisjs/application/build/adonis-typings/application" />
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
import { QueryClientContract } from '@ioc:Adonis/Lucid/Database';
import { LucidProviderModel, LucidProviderConfig, ProviderUserContract, LucidProviderContract } from '@ioc:Adonis/Addons/Auth';
/**
* Lucid provider uses Lucid models to lookup a users
*/
export declare class LucidProvider implements LucidProviderContract<LucidProviderModel> {
private application;
private config;
/**
* Hooks reference
*/
private hooks;
/**
* Custom connection or query client
*/
private connection?;
constructor(application: ApplicationContract, config: LucidProviderConfig<LucidProviderModel>);
/**
* The models options for constructing a query
*/
private getModelOptions;
/**
* Returns the auth model
*/
private getModel;
/**
* Returns query instance for the user model
*/
private getModelQuery;
/**
* Executes the query to find the user, calls the registered hooks
* and wraps the result inside [[ProviderUserContract]]
*/
private findUser;
/**
* Returns an instance of the [[ProviderUser]] by wrapping lucid model
* inside it
*/
getUserFor(user: InstanceType<LucidProviderModel> | null): Promise<any>;
/**
* Define custom connection
*/
setConnection(connection: string | QueryClientContract): this;
/**
* Define before hooks. Check interface for exact type information
*/
before(event: 'findUser', callback: (query: any) => Promise<void>): this;
/**
* Define after hooks. Check interface for exact type information
*/
after(event: 'findUser', callback: (...args: any[]) => Promise<void>): this;
/**
* Returns a user instance using the primary key value
*/
findById(id: string | number): Promise<any>;
/**
* Returns a user instance using a specific token type and value
*/
findByRememberMeToken(id: string | number, value: string): Promise<any>;
/**
* Returns the user instance by searching the uidValue against
* their defined uids.
*/
findByUid(uidValue: string): Promise<any>;
/**
* Updates the user remember me token. The guard must called `setRememberMeToken`
* before invoking this method.
*/
updateRememberMeToken(providerUser: ProviderUserContract<InstanceType<LucidProviderModel>>): Promise<void>;
}