UNPKG

@labshare/services-auth

Version:

Loopback 4 plugin for resource scope-based HTTP route authz

23 lines (22 loc) 871 B
import { Constructor } from '@loopback/context'; /** * Authentication metadata stored via Reflection API */ export interface AuthenticationMetadata { scope?: string[]; credentialsRequired?: boolean; } /** * Mark a controller method as requiring authenticated user. * * @param options Additional options to configure the authentication. * @param options.scope Resource Scopes required by the method */ export declare function authenticate(options?: AuthenticationMetadata): (target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor<any>) => any; /** * Fetch authentication metadata stored by `@authenticate` decorator. * * @param controllerClass Target controller * @param methodName Target method */ export declare function getAuthenticateMetadata(targetClass: Constructor<{}>, methodName: string): AuthenticationMetadata | undefined;