jbonofre commented on code in PR #1863:
URL: https://github.com/apache/karaf/pull/1863#discussion_r1778528917
##########
jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesBackingEngine.java:
##########
@@ -52,14 +52,13 @@ public void addUser(String username, String password) {
if (username.startsWith(GROUP_PREFIX))
throw new IllegalArgumentException("Prefix not permitted: " +
GROUP_PREFIX);
- addUserInternal(username, password);
+ addUserInternal(username, encryptionSupport.encrypt(password));
Review Comment:
Why forcing encryption here ? It's an optional feature.
##########
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:
A group can be empty (no role, no group, no user).
--
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]