File tree 3 files changed +9
-6
lines changed
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 {
129
129
130
130
export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
131
131
132
- constructor ( protected event : AWSLambda . APIGatewayProxyEventV2 , private _logger : logger . LambdaLog ) {
132
+ constructor ( protected event : AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer , private _logger : logger . LambdaLog ) {
133
133
super ( ) ;
134
134
}
135
135
@@ -143,7 +143,7 @@ export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
143
143
if ( ! authHeader || ! authHeader . startsWith ( 'Bearer ' ) ) {
144
144
return ;
145
145
}
146
- const token = authHeader . substr ( 'Bearer ' . length ) ;
146
+ const token = authHeader . substring ( 'Bearer ' . length ) ;
147
147
try {
148
148
const claims : { [ name : string ] : string } = await promisedVerify ( token ) ;
149
149
this . _logger . debug ( JSON . stringify ( claims ) ) ;
@@ -153,6 +153,8 @@ export class ApiGatewayv2CognitoAuthorizer extends CognitoAuthorizer {
153
153
claims,
154
154
scopes : [ 'openid' , 'email' ] ,
155
155
} ,
156
+ integrationLatency : 0 ,
157
+ principalId : 'toolbox' ,
156
158
} ;
157
159
this . claims = claims ;
158
160
} catch ( err : any ) {
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ export interface Operation {
36
36
} ;
37
37
}
38
38
39
- export type APIGatewayv2Handler = AWSLambda . Handler < AWSLambda . APIGatewayProxyEventV2 , AWSLambda . APIGatewayProxyStructuredResultV2 | undefined > ;
39
+ export type APIGatewayv2Handler =
40
+ AWSLambda . Handler < AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer , AWSLambda . APIGatewayProxyStructuredResultV2 | undefined > ;
40
41
41
42
export interface OperationWithRequestBody extends Operation {
42
43
requestBody : { content : { 'application/json' : any } } ;
Original file line number Diff line number Diff line change 1
1
import * as Boom from '@hapi/boom' ;
2
- import { createHttpHandler } from '../src/http/handler' ;
2
+ import { createHttpHandler } from '../src/http/handler' ;
3
3
4
4
test ( 'Boom error support for createHttpHandler' , async ( ) => {
5
5
const boomErr = Boom . notImplemented ( ) ;
@@ -14,9 +14,9 @@ test('Boom error support for createHttpHandler', async () => {
14
14
rawPath : '/raw/path' ,
15
15
rawQueryString : '' ,
16
16
isBase64Encoded : false ,
17
- } as AWSLambda . APIGatewayProxyEventV2 ;
17
+ } as AWSLambda . APIGatewayProxyEventV2WithJWTAuthorizer ;
18
18
const context = { } as AWSLambda . Context ;
19
- const result = await handler ( event , context , ( ) => { } ) ;
19
+ const result = await handler ( event , context , ( ) => { } ) ;
20
20
21
21
if ( ! result ) {
22
22
throw new Error ( 'handler is expected to return a result!' ) ;
You can’t perform that action at this time.
0 commit comments