mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-5946 force lowercase userid (#3074)
Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
co-authored by
Evgenia
parent
5293be4d4a
commit
0943b80942
@@ -529,7 +529,7 @@ public abstract class CBApplication<T extends CBServerConfig> extends
|
||||
}
|
||||
|
||||
if (isConfigurationMode()) {
|
||||
finishSecurityServiceConfiguration(adminName, adminPassword, authInfoList);
|
||||
finishSecurityServiceConfiguration(adminName.toLowerCase(), adminPassword, authInfoList);
|
||||
}
|
||||
|
||||
// Save runtime configuration
|
||||
|
||||
+6
-1
@@ -851,8 +851,13 @@ public class CBEmbeddedSecurityController<T extends WebAuthApplication>
|
||||
}
|
||||
List<String[]> transformedCredentials;
|
||||
WebAuthProviderDescriptor authProvider = getAuthProvider(authProviderId);
|
||||
if (authProvider.isCaseInsensitive() && !isSubjectExists(userId) && isSubjectExists(userId.toLowerCase())) {
|
||||
log.warn("User with id '" + userId + "' not found, credentials will be set for the user: " + userId.toLowerCase());
|
||||
userId = userId.toLowerCase();
|
||||
}
|
||||
try {
|
||||
SMAuthCredentialsProfile credProfile = getCredentialProfileByParameters(authProvider, credentials.keySet());
|
||||
String finalUserId = userId;
|
||||
transformedCredentials = credentials.entrySet().stream().map(cred -> {
|
||||
String propertyName = cred.getKey();
|
||||
AuthPropertyDescriptor property = credProfile.getCredentialParameter(propertyName);
|
||||
@@ -860,7 +865,7 @@ public class CBEmbeddedSecurityController<T extends WebAuthApplication>
|
||||
return null;
|
||||
}
|
||||
String encodedValue = CommonUtils.toString(cred.getValue());
|
||||
encodedValue = property.getEncryption().encrypt(userId, encodedValue);
|
||||
encodedValue = property.getEncryption().encrypt(finalUserId, encodedValue);
|
||||
return new String[]{propertyName, encodedValue};
|
||||
}).toList();
|
||||
} catch (Exception e) {
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@
|
||||
package io.cloudbeaver.service.security.db;
|
||||
|
||||
import org.jkiss.dbeaver.model.security.user.SMTeam;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,7 +27,7 @@ class CBDatabaseInitialData {
|
||||
private List<SMTeam> teams;
|
||||
|
||||
public String getAdminName() {
|
||||
return adminName;
|
||||
return CommonUtils.isEmpty(adminName) ? null : adminName.toLowerCase();
|
||||
}
|
||||
|
||||
public String getAdminPassword() {
|
||||
|
||||
Reference in New Issue
Block a user