stataru8 commented on code in PR #1863:
URL: https://github.com/apache/karaf/pull/1863#discussion_r1778853618


##########
jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngine.java:
##########
@@ -157,22 +159,37 @@ private List<RolePrincipal> listRoles(String name) {
         return result;
     }
 
+    private int getFirstRoleIndex(String name) {
+        if (name.trim().startsWith(PropertiesBackingEngine.GROUP_PREFIX)) {
+            return 0;
+        }
+        return 1;
+    }
+
     @Override
     public void addRole(String username, String role) {
         String userInfos = users.get(username);
         if (userInfos != null) {
-            for (RolePrincipal rp : listRoles(username)) {
-                if (role.equals(rp.getName())) {
-                    return; 
+
+            // groups don't have password and empty should be ignored

Review Comment:
   My original comment was a bit misleading, what I meant is:
   - If a **user** info is empty, we shouldn't replace `""` by `role`, or else 
`role` becomes the user's password.
   - If a **group** info is empty, we should replace `""` by `role`.
   



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