UNPKG

@tsed/common

Version:
24 lines (23 loc) 640 B
import { Type } from "@tsed/core"; import { IAuthOptions } from "./authOptions"; /** * Use custom authentication strategy on your endpoint. * * ```typescript * @Controller('/mypath') * @UseAuth(MyAuthStrategy) * class MyCtrl { * * @Get('/') * @UseAuth(MyAuthStrategy, {role: 'admin'}) * public getResource(){} * } * ``` * * @param guardAuth {Type<any>} A middleware which implement a custom auth strategy * @param options {Object} Object passed to the customer auth strategy * @returns {Function} * @decorator * @operation */ export declare function UseAuth(guardAuth: Type<any>, options?: IAuthOptions): Function;