How to use the @loopback/core.MethodDecoratorFactory.createDecorator function in @loopback/core

To help you get started, we’ve selected a few @loopback/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iqbaldjulfri / lb4-jwt-role-based-auth-sample / src / auth.ts View on Github external
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,
  });
}
github strongloop / loopback-next / packages / openapi-v3 / src / decorators / operation.decorator.ts View on Github external
export function operation(verb: string, path: string, spec?: OperationObject) {
  return MethodDecoratorFactory.createDecorator>(
    OAI3Keys.METHODS_KEY,
    {
      verb,
      path,
      spec,
    },
    {decoratorName: '@operation'},
  );
}
github sourcefuse / loopback4-authorization / src / decorators / authorize.decorator.ts View on Github external
export function authorize(permissions: string[]) {
  return MethodDecoratorFactory.createDecorator(
    AUTHORIZATION_METADATA_ACCESSOR,
    {
      permissions: permissions || [],
    },
  );
}