File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ export abstract class CognitoAuthorizer {
129129
130130export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
131131
132- constructor ( protected event : AWSLambda . APIGatewayProxyEventV2 , private _logger : logger . LambdaLog ) {
132+ constructor ( protected event : AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer , private _logger : logger . LambdaLog ) {
133133 super ( ) ;
134134 }
135135
@@ -143,7 +143,7 @@ export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
143143 if ( ! authHeader || ! authHeader . startsWith ( 'Bearer ' ) ) {
144144 return ;
145145 }
146- const token = authHeader . substr ( 'Bearer ' . length ) ;
146+ const token = authHeader . substring ( 'Bearer ' . length ) ;
147147 try {
148148 const claims : { [ name : string ] : string } = await promisedVerify ( token ) ;
149149 this . _logger . debug ( JSON . stringify ( claims ) ) ;
@@ -153,6 +153,8 @@ export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
153153 claims,
154154 scopes : [ 'openid' , 'email' ] ,
155155 } ,
156+ integrationLatency : 0 ,
157+ principalId : 'toolbox' ,
156158 } ;
157159 this . claims = claims ;
158160 } catch ( err : any ) {
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ export interface Operation {
3636 } ;
3737}
3838
39- export type APIGatewayv2Handler = AWSLambda . Handler < AWSLambda . APIGatewayProxyEventV2 , AWSLambda . APIGatewayProxyStructuredResultV2 | undefined > ;
39+ export type APIGatewayv2Handler =
40+ AWSLambda . Handler < AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer , AWSLambda . APIGatewayProxyStructuredResultV2 | undefined > ;
4041
4142export interface OperationWithRequestBody extends Operation {
4243 requestBody : { content : { 'application/json' : any } } ;
Original file line number Diff line number Diff line change 11import * as Boom from '@hapi/boom' ;
2- import { createHttpHandler } from '../src/http/handler' ;
2+ import { createHttpHandler } from '../src/http/handler' ;
33
44test ( 'Boom error support for createHttpHandler' , async ( ) => {
55 const boomErr = Boom . notImplemented ( ) ;
@@ -14,9 +14,9 @@ test('Boom error support for createHttpHandler', async () => {
1414 rawPath : '/raw/path' ,
1515 rawQueryString : '' ,
1616 isBase64Encoded : false ,
17- } as AWSLambda . APIGatewayProxyEventV2 ;
17+ } as AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer ;
1818 const context = { } as AWSLambda . Context ;
19- const result = await handler ( event , context , ( ) => { } ) ;
19+ const result = await handler ( event , context , ( ) => { } ) ;
2020
2121 if ( ! result ) {
2222 throw new Error ( 'handler is expected to return a result!' ) ;
You can’t perform that action at this time.
0 commit comments