@adonisjs/auth
Version:
Official authentication provider for Adonis framework
118 lines (117 loc) • 3.55 kB
TypeScript
/// <reference types="@adonisjs/application/build/adonis-typings/application" />
import { AuthConfig, GuardsList, AuthManagerContract, ExtendGuardCallback, ExtendProviderCallback, ExtendClientCallback } from '@ioc:Adonis/Addons/Auth';
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
/**
* Auth manager to manage guards and providers object. The extend API can
* be used to add custom guards and providers
*/
export declare class AuthManager implements AuthManagerContract {
application: ApplicationContract;
private config;
/**
* Extended set of testing clients
*/
private extendedClients;
/**
* Extended set of providers
*/
private extendedProviders;
/**
* Extend set of guards
*/
private extendedGuards;
/**
* Reference to the default guard
*/
defaultGuard: keyof GuardsList;
constructor(application: ApplicationContract, config: AuthConfig);
/**
* Verifies and returns an instance of the event emitter
*/
private getEmitter;
/**
* Lazily makes an instance of the lucid provider
*/
private makeLucidProvider;
/**
* Lazily makes an instance of the database provider
*/
private makeDatabaseProvider;
/**
* Returns an instance of the extended provider
*/
private makeExtendedProvider;
/**
* Lazily makes an instance of the token database provider
*/
private makeTokenDatabaseProvider;
/**
* Lazily makes an instance of the token redis provider
*/
private makeTokenRedisProvider;
/**
* Returns an instance of the session guard
*/
private makeSessionGuard;
/**
* Returns an instance of the session guard
*/
private makeOatGuard;
/**
* Returns an instance of the basic auth guard
*/
private makeBasicAuthGuard;
/**
* Returns an instance of the extended guard
*/
private makeExtendedGuard;
/**
* Returns an instance of the session client
*/
private makeSessionClient;
/**
* Returns an instance of the session client
*/
private makeOatClient;
/**
* Returns an instance of the extended client
*/
private makeExtendedClient;
/**
* Makes client instance for the defined driver inside the
* mapping config.
*/
private makeClientInstance;
/**
* Makes instance of a provider based upon the driver value
*/
private makeUserProviderInstance;
/**
* Makes instance of a provider based upon the driver value
*/
private makeTokenProviderInstance;
/**
* Makes guard instance for the defined driver inside the
* mapping config.
*/
private makeGuardInstance;
/**
* Make an instance of a given mapping for the current HTTP request.
*/
makeMapping(ctx: HttpContextContract, mapping: keyof GuardsList): any;
/**
* Returns an instance of the testing
*/
client(mapping: keyof GuardsList): any;
/**
* Returns an instance of the auth class for the current request
*/
getAuthForRequest(ctx: HttpContextContract): any;
/**
* Extend auth by adding custom providers and guards
*/
extend(type: 'provider', name: string, callback: ExtendProviderCallback): void;
extend(type: 'guard', name: string, callback: ExtendGuardCallback): void;
extend(type: 'client', name: string, callback: ExtendClientCallback): void;
}