UNPKG

775 BTypeScriptView Raw
1import type { HttpContext } from '@adonisjs/core/http';
2import type { NextFn } from '@adonisjs/core/types/http';
3import type { Authenticator } from '../authenticator.js';
4import type { Authenticators, GuardFactory } from '../types.js';
5/**
6 * The "InitializeAuthMiddleware" is used to create a request
7 * specific authenticator instance for every HTTP request.
8 *
9 * This middleware does not protect routes from unauthenticated
10 * users. Please use the "auth" middleware for that.
11 */
12export default class InitializeAuthMiddleware {
13 handle(ctx: HttpContext, next: NextFn): Promise<any>;
14}
15declare module '@adonisjs/core/http' {
16 interface HttpContext {
17 auth: Authenticator<Authenticators extends Record<string, GuardFactory> ? Authenticators : never>;
18 }
19}