UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

48 lines (47 loc) 1.61 kB
import type { SchemaOverview } from '@directus/types'; import type { Knex } from 'knex'; import { UsersService } from '../services/users.js'; import type { AuthDriverOptions, User } from '../types/index.js'; export declare abstract class AuthDriver { knex: Knex; constructor(options: AuthDriverOptions, _config: Record<string, any>); protected getUsersService(schema: SchemaOverview): UsersService; /** * Get user id for a given provider payload * * @param payload Any data that the user might've provided * @throws InvalidCredentialsError * @return User id of the identifier */ abstract getUserID(payload: Record<string, any>): Promise<string>; /** * Verify user password * * @param user User information * @param password User password * @throws InvalidCredentialsError */ abstract verify(user: User, password?: string): Promise<void>; /** * Check with the (external) provider if the user is allowed entry to Directus * * @param _user User information * @param _payload Any data that the user might've provided * @throws InvalidCredentialsError * @returns Data to be stored with the session */ login(_user: User, _payload: Record<string, any>): Promise<void>; /** * Handle user session refresh * * @param _user User information * @throws InvalidCredentialsError */ refresh(_user: User): Promise<void>; /** * Handle user session termination * * @param _user User information */ logout(_user: User): Promise<void>; }