idea-aws 3.10.3 → 3.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,8 +106,10 @@ class ResourceController extends genericController_1.GenericController {
106
106
  }
107
107
  initFromEventV2(event, options) {
108
108
  this.authorization = event.headers.authorization;
109
- const contextFromAuthorizer = event.requestContext?.authorizer?.lambda || {};
110
- this.principalId = contextFromAuthorizer.principalId;
109
+ const authorizer = event.requestContext?.authorizer ?? {};
110
+ const contextFromAuthorizer = authorizer.lambda ?? authorizer.jwt?.claims ?? {};
111
+ this.principalId = contextFromAuthorizer.principalId ?? contextFromAuthorizer.sub ?? null;
112
+ this.cognitoUser = authorizer.jwt?.claims ? new idea_toolbox_1.CognitoUser(authorizer.jwt?.claims) : null;
111
113
  this.stage = event.requestContext.stage;
112
114
  this.httpMethod = event.requestContext.http.method;
113
115
  this.resource = event.routeKey.replace('+', ''); // {proxy+} -> {proxy}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "3.10.3",
3
+ "version": "3.10.4",
4
4
  "description": "AWS wrappers to use in IDEA's back-ends",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",