Skip to content

Commit cd00513

Browse files
committed
Fix duplicate users due to config keys not supporting upper and lower case
1 parent d5735a2 commit cd00513

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

bambu/src/main/java/com/tfyre/servlet/TFyreIdentityProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import java.security.Security;
1818
import java.security.spec.InvalidKeySpecException;
1919
import java.util.HashMap;
20+
import java.util.HashSet;
2021
import java.util.Map;
2122
import java.util.Optional;
23+
import java.util.Set;
2224
import java.util.stream.Collectors;
2325
import org.wildfly.security.credential.PasswordCredential;
2426
import org.wildfly.security.evidence.PasswordGuessEvidence;
@@ -44,8 +46,10 @@ public void postConstruct() {
4446
map.put(userPass, new User(BcryptUtil.bcryptHash(userPass), SystemRoles.ROLE_ADMIN));
4547
return;
4648
}
49+
final Set<String> seen = new HashSet<>();
4750
map.putAll(config.users().entrySet()
4851
.stream()
52+
.filter(e -> seen.add(e.getKey().toLowerCase()))
4953
.collect(Collectors.toMap(e -> e.getKey().toLowerCase(), e -> {
5054
String password = e.getValue().password();
5155
if (ModularCrypt.identifyAlgorithm(password.toCharArray()) == null) {

0 commit comments

Comments
 (0)