UNPKG

@teamsight/flight

Version:

Lambda life cycles

14 lines (13 loc) 989 B
import { Context, CustomAuthorizerEvent, CustomAuthorizerResult, PolicyDocument } from "aws-lambda"; import { IJsonWebTokenManager, IPayload } from "../../jwt/json-web-token-manager"; import { AuthorizerHandler } from "./authorizer-handler"; export declare abstract class Authorizer<TPayload extends IPayload, TAuthContext> extends AuthorizerHandler { private jwtHelper; protected abstract audience: string; constructor(jwtHelper: IJsonWebTokenManager); run(event: CustomAuthorizerEvent, context: Context): Promise<CustomAuthorizerResult>; protected abstract createAuthorizerContext(payload: TPayload): Promise<TAuthContext>; protected abstract doAuthorization(event: CustomAuthorizerEvent, decoded: TPayload, customContext: TAuthContext): Promise<void>; protected createResult(effect: "Allow" | "Deny", arn: string, customContext?: any, principalId?: string): CustomAuthorizerResult; protected buildPolicy(effect: string, resource: any): PolicyDocument; }