adutra commented on code in PR #5140:
URL: https://github.com/apache/polaris/pull/5140#discussion_r3659092356
##########
runtime/service/src/main/java/org/apache/polaris/service/auth/AuthenticatingAugmentor.java:
##########
@@ -61,11 +64,14 @@ public Uni<SecurityIdentity> augment(
private SecurityIdentity authenticatePolarisPrincipal(SecurityIdentity
identity) {
PolarisPrincipal polarisPrincipal = authenticator.authenticate(identity);
+ Map<String, Object> attributes =
+ polarisPrincipal.getAttributes().entrySet().stream()
+ .collect(Collectors.toMap(entry -> entry.key().key(),
AttributeMap.Attribute::value));
return QuarkusSecurityIdentity.builder(identity)
.setAnonymous(false)
.setPrincipal(polarisPrincipal)
.addRoles(polarisPrincipal.getRoles())
- .addAttributes(polarisPrincipal.getAttributes())
+ .addAttributes(attributes)
Review Comment:
It's still there, but I refactored following Copilot's suggestion.
Exposing the exact same attributes on both sides brings coherence and avoids
surprises imho. As for exposing too much information: any component that can
consume a `PolarisPrincipal` already has access to this information; injecting
a `SecurityIdentity` wouldn't expose more. So in the end, I think exposing the
same attributes is slightly preferrable. But I'm open to other ideas!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]