32 lines
962 B
TypeScript
32 lines
962 B
TypeScript
|
|
/**
|
||
|
|
* Authentication and authorization middleware
|
||
|
|
*/
|
||
|
|
import { FastifyRequest, FastifyReply } from 'fastify';
|
||
|
|
export interface AuthUser {
|
||
|
|
id: string;
|
||
|
|
email?: string;
|
||
|
|
did?: string;
|
||
|
|
roles?: string[];
|
||
|
|
}
|
||
|
|
declare module 'fastify' {
|
||
|
|
interface FastifyRequest {
|
||
|
|
user?: AuthUser;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* JWT authentication middleware
|
||
|
|
*/
|
||
|
|
export declare function authenticateJWT(request: FastifyRequest, _reply: FastifyReply): Promise<void>;
|
||
|
|
/**
|
||
|
|
* DID-based authentication middleware
|
||
|
|
*/
|
||
|
|
export declare function authenticateDID(request: FastifyRequest, _reply: FastifyReply): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Role-based access control middleware
|
||
|
|
*/
|
||
|
|
export declare function requireRole(...allowedRoles: string[]): (request: FastifyRequest, _reply: FastifyReply) => Promise<void>;
|
||
|
|
/**
|
||
|
|
* OIDC token validation middleware
|
||
|
|
*/
|
||
|
|
export declare function authenticateOIDC(request: FastifyRequest, _reply: FastifyReply): Promise<void>;
|
||
|
|
//# sourceMappingURL=auth.d.ts.map
|