Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function secured(
type: SecuredType = SecuredType.IS_AUTHENTICATED, // more on this below
roles: string[] = [],
strategy: string = 'jwt',
options?: object,
) {
// we will use a custom interface. more on this below
return MethodDecoratorFactory.createDecorator(AUTHENTICATION_METADATA_KEY, {
type,
roles,
strategy,
options,
});
}
export function operation(verb: string, path: string, spec?: OperationObject) {
return MethodDecoratorFactory.createDecorator>(
OAI3Keys.METHODS_KEY,
{
verb,
path,
spec,
},
{decoratorName: '@operation'},
);
}
export function authorize(permissions: string[]) {
return MethodDecoratorFactory.createDecorator(
AUTHORIZATION_METADATA_ACCESSOR,
{
permissions: permissions || [],
},
);
}