import { BindingAddress, MetadataAccessor, MetadataMap, MethodDecoratorFactory } from '@loopback/core'; import { AuthorizationMetadata, Authorizer } from '../types'; export declare const AUTHORIZATION_METHOD_KEY: MetadataAccessor; export declare const AUTHORIZATION_CLASS_KEY: MetadataAccessor; export declare class AuthorizeMethodDecoratorFactory extends MethodDecoratorFactory { protected mergeWithOwn(ownMetadata: MetadataMap, target: Object, methodName?: string, methodDescriptor?: TypedPropertyDescriptor | number): MetadataMap; private merge; } /** * Decorator `@authorize` to mark methods that require authorization * * @param spec Authorization metadata */ export declare function authorize(spec: AuthorizationMetadata): (target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor) => any; export declare namespace authorize { /** * Shortcut to configure allowed roles * @param roles */ const allow: (...roles: string[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Shortcut to configure denied roles * @param roles */ const deny: (...roles: string[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Shortcut to specify access scopes * @param scopes */ const scope: (...scopes: string[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Shortcut to configure voters * @param voters */ const vote: (...voters: (Authorizer | BindingAddress)[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Allows all */ const allowAll: () => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Allow all but the given roles * @param roles */ const allowAllExcept: (...roles: string[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Deny all */ const denyAll: () => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Deny all but the given roles * @param roles */ const denyAllExcept: (...roles: string[]) => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Allow authenticated users */ const allowAuthenticated: () => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Deny unauthenticated users */ const denyUnauthenticated: () => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; /** * Skip authorization */ const skip: () => (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor | undefined) => any; } /** * Fetch authorization metadata stored by `@authorize` decorator. * * @param target Target object/class * @param methodName Target method */ export declare function getAuthorizationMetadata(target: object, methodName: string): AuthorizationMetadata | undefined;