Skip to content

Commit

Permalink
feat(cb2-8084): add new perms for auth
Browse files Browse the repository at this point in the history
  • Loading branch information
naathanbrown committed Jun 2, 2023
1 parent d490a25 commit 9e843cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/functions/functionalConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export const functionConfig: { [key: string]: NonEmptyArray<IApiAccess> } = {
verbs: ["GET", "OPTIONS"],
path: "v2/vehicles/*",
},
{
verbs: ["GET", "OPTIONS"],
path: "v3/technical-records/*",
},
],
"TechRecord.Archive": [
{
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/functions/authoriser.unitTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("authorizer() unit tests", () => {

expect(returnValue.principalId).toEqual(jwtJson.payload.sub);

expect(returnValue.policyDocument.Statement.length).toEqual(4);
expect(returnValue.policyDocument.Statement.length).toEqual(6);
expect(returnValue.policyDocument.Statement).toContainEqual({
Effect: "Allow",
Action: "execute-api:Invoke",
Expand All @@ -122,7 +122,7 @@ describe("authorizer() unit tests", () => {
const returnValue: APIGatewayAuthorizerResult = await authorizer(event, exampleContext());

expect(returnValue.principalId).toEqual(jwtJson.payload.sub);
expect(returnValue.policyDocument.Statement.length).toEqual(8);
expect(returnValue.policyDocument.Statement.length).toEqual(10);
});

it("should return an accurate policy based on functional roles", async () => {
Expand All @@ -131,7 +131,7 @@ describe("authorizer() unit tests", () => {
const returnValue: APIGatewayAuthorizerResult = await authorizer(event, exampleContext());

expect(returnValue.principalId).toEqual(jwtJson.payload.sub);
expect(returnValue.policyDocument.Statement.length).toEqual(8);
expect(returnValue.policyDocument.Statement.length).toEqual(10);

const post: { Action: string; Effect: string; Resource: string } = returnValue.policyDocument.Statement[0] as unknown as { Action: string; Effect: string; Resource: string };
expect(post.Effect).toEqual("Allow");
Expand Down

0 comments on commit 9e843cb

Please sign in to comment.