UNPKG

@adonisjs/auth

Version:

Official authentication provider for Adonis framework

44 lines (43 loc) 1.37 kB
import { DatabaseContract, QueryClientContract } from '@ioc:Adonis/Lucid/Database'; import { TokenProviderContract, ProviderTokenContract, DatabaseTokenProviderConfig } from '@ioc:Adonis/Addons/Auth'; import { ProviderToken } from '../../Tokens/ProviderToken'; /** * Database backend tokens provider */ export declare class TokenDatabaseProvider implements TokenProviderContract { private config; private db; constructor(config: DatabaseTokenProviderConfig, db: DatabaseContract); /** * Custom connection or query client */ private connection?; /** * Returns the query client for database queries */ private getQueryClient; /** * The foreign key column */ private foreignKey; /** * Returns the builder query for a given token + type */ private getLookupQuery; /** * Define custom connection */ setConnection(connection: string | QueryClientContract): this; /** * Reads the token using the lookup token id */ read(tokenId: string, tokenHash: string, tokenType: string): Promise<ProviderTokenContract | null>; /** * Saves the token and returns the persisted token lookup id. */ write(token: ProviderToken): Promise<string>; /** * Removes a given token */ destroy(tokenId: string, tokenType: string): Promise<void>; }