import type { UserInfo } from './user-info.js'; import type { FastifyRequest } from 'fastify'; import { ApiAuthorizationResult } from './api-authorization-result.js'; import { ApiAuthenticationResult } from './api-authentication-result.js'; /** * Interface for authentication providers */ export interface IApiAuthProvider { /** * Extracts the authentication token from the request * @param request */ extractToken(request: FastifyRequest): Promise; /** * Authenticates a token and extracts user information * * @param token JWT or other token to authenticate * @returns Authentication result with user info if successful */ authenticateToken(token: string): Promise; /** * Authorizes a user for a specific request * * @param user User information * @param request Fastify request * @returns Authorization result */ authorizeUser(user: UserInfo, request: FastifyRequest): Promise; }