import { IdentityInterface, Request } from "@pristine-ts/common"; import { GuardInterface } from "../interfaces/guard.interface"; import { GuardContextInterface } from "../interfaces/guard-context.interface"; import { LogHandlerInterface } from "@pristine-ts/logging"; /** * The role guard is a guard that validates if the identity making the request has the required roles. */ export declare class RoleGuard implements GuardInterface { private readonly rolesClaimKey; private readonly logHandler; /** * The keyname of the guard. */ keyname: string; /** * The context for the guard to use. */ guardContext?: GuardContextInterface; /** * The role guard is a guard that validates if the identity making the request has the required roles. * @param rolesClaimKey The key in the claims of the access token where the roles are defined. */ constructor(rolesClaimKey: string, logHandler: LogHandlerInterface); /** * Sets the context for the guard. * @param context The context for the guard to use. */ setContext(context: any): Promise; /** * Returns whether or not the guard authorizes the request. * For the role guard, it validates that the identity making the request has the requested roles. * The identity needs all of the requested roles to be authorized. * @param request The request to authorize. * @param identity The identity making the request. */ isAuthorized(request: Request, identity?: IdentityInterface): Promise; }