Skip to content

Commit

Permalink
fix: claims
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Torres committed Sep 1, 2023
1 parent db05784 commit c5efd44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libs/eventually-aws/src/lambda/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {
CommandHandlerFactory,
app,
camelize,
client,
log
client
} from "@rotorsoft/eventually";
import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda";
import { BadRequest, Ok, httpError } from "./http";
Expand Down Expand Up @@ -40,9 +39,10 @@ export const command = async ({
parsedPath: `/${system}/${stream}/${command}`
});

log().trace("Auth", requestContext.authorizer);
const claims = requestContext.authorizer?.jwt?.claims;
const actor = { id: claims?.email ?? "", name: claims?.name ?? "" };
// TODO: check all options to get claims from context
const claims = requestContext.authorizer?.claims;
const actor = claims ? { id: claims.sub, name: claims.email } : undefined;

const data: Record<string, any> = body ? JSON.parse(body) : {};
const snap = await client().command(
md.factory as CommandHandlerFactory,
Expand Down

0 comments on commit c5efd44

Please sign in to comment.