Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Oct 6, 2023
1 parent 2460009 commit 2eb717c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ private Collection<String> loadJwtGroups(final ApiGatewayRequestEvent event) {
}
}

groups.remove("authentication_only");
if (groups.contains("authentication_only")) {
groups.clear();
}

return groups;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,24 @@ void testApiAuthorizer12() throws Exception {
api0.permissions().stream().map(p -> p.name()).collect(Collectors.joining(",")));
assertEquals("no groups", api0.accessSummary());
}

/**
* Basic 'authentication_only' access.
*/
@Test
void testApiAuthorizer13() throws Exception {
// given
String s0 = "[finance authentication_only]";
ApiGatewayRequestEvent event0 = getJwtEvent(s0);

// when
ApiAuthorization api0 = new ApiAuthorizationBuilder().build(event0);

// then
assertNull(api0.siteId());
assertEquals("", String.join(",", api0.siteIds()));
assertEquals("",
api0.permissions().stream().map(p -> p.name()).collect(Collectors.joining(",")));
assertEquals("no groups", api0.accessSummary());
}
}

0 comments on commit 2eb717c

Please sign in to comment.