@thisisagile/easy-express
Version:
Straightforward library for building domain-driven microservice architectures
20 lines (19 loc) • 928 B
TypeScript
import type { NextFunction, Request, RequestHandler, Response } from 'express';
import type { Algorithm } from 'jsonwebtoken';
import type { Scope, UseCase } from '@thisisagile/easy';
type EasySecretOrKeyProvider = (request: Request, rawJwtToken: any) => Promise<string | Buffer>;
export interface SecurityOptions {
jwtStrategyOptions?: {
secretOrKey?: string | Buffer;
secretOrKeyProvider?: EasySecretOrKeyProvider;
issuer?: string;
audience?: string;
algorithms?: Algorithm[];
};
}
export declare const checkLabCoat: () => RequestHandler;
export declare const checkToken: () => RequestHandler;
export declare const checkScope: (scope: Scope) => RequestHandler;
export declare const checkUseCase: (uc: UseCase) => RequestHandler;
export declare const security: ({ jwtStrategyOptions }?: SecurityOptions) => ((req: Request, res: Response, next: NextFunction) => void);
export {};