smolnar82 commented on code in PR #681:
URL: https://github.com/apache/knox/pull/681#discussion_r1045689517


##########
gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AccessTokenFederationFilter.java:
##########
@@ -176,6 +172,6 @@ private Subject createSubjectFromToken(JWTToken token) {
     // To modify the Principals Set, the caller must have 
AuthPermission("modifyPrincipals").
     // To modify the public credential Set, the caller must have 
AuthPermission("modifyPublicCredentials").
     // To modify the private credential Set, the caller must have 
AuthPermission("modifyPrivateCredentials").
-    return new javax.security.auth.Subject(true, principals, emptySet, 
emptySet);
+    return new javax.security.auth.Subject(true, principals, 
Collections.emptySet(), Collections.emptySet());

Review Comment:
   This is a valid question. The answer is that it's even better than the 
implementation before due to the very same reason you described: once this 
subject is created, the principals cannot be modified. In lower layers, like in 
identity assertion, if someone wants to proceed with different principals, a 
new Subject has to be created and call `Subject.doAs`.



-- 
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]

Reply via email to