You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2026/08/15 11:39:52 UTC

(cloudstack) 08/10: move SSOKey configuration item from deprecated Config enum to services

This is an automated email from the ASF dual-hosted git repository.

DaanHoogland pushed a commit to branch ghi10752-configCleanup
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit e18b699bcfa57963bbe5694c147a8511f46be578
Author: Daan Hoogland <da...@apache.org>
AuthorDate: Sat Aug 15 10:35:36 2026 +0200

    move SSOKey configuration item from deprecated Config enum to services
---
 server/src/main/java/com/cloud/configuration/Config.java           | 1 -
 server/src/main/java/com/cloud/server/ConfigurationServerImpl.java | 3 ++-
 server/src/main/java/com/cloud/user/AccountManager.java            | 3 +++
 server/src/main/java/com/cloud/user/AccountManagerImpl.java        | 4 ++--
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/com/cloud/configuration/Config.java b/server/src/main/java/com/cloud/configuration/Config.java
index 455d06858ca..7f2a0522b7b 100644
--- a/server/src/main/java/com/cloud/configuration/Config.java
+++ b/server/src/main/java/com/cloud/configuration/Config.java
@@ -800,7 +800,6 @@ public enum Config {
             "Should we automatically add XenServers into pools that are inside a Pod",
             null),
     CloudIdentifier("Hidden", ManagementServer.class, String.class, "cloud.identifier", null, "A unique identifier for the cloud.", null),
-    SSOKey("Secure", ManagementServer.class, String.class, "security.singlesignon.key", null, "A Single Sign-On key used for logging into the cloud", null),
     SSOAuthTolerance(
             "Advanced",
             ManagementServer.class,
diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
index def564dfdc6..53677ee0ff1 100644
--- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
@@ -94,6 +94,7 @@ import com.cloud.storage.Storage.ProvisioningType;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.test.IPRangeConfig;
 import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
 import com.cloud.user.AccountVO;
 import com.cloud.user.User;
 import com.cloud.user.dao.AccountDao;
@@ -820,7 +821,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
 
     private void updateSSOKey() {
         try {
-            _configDao.update(Config.SSOKey.key(), Config.SSOKey.getCategory(), getPrivateKey());
+            _configDepot.createOrUpdateConfigObject(AccountManager.class.getSimpleName(), AccountManager.SSOKey, getPrivateKey());
         } catch (NoSuchAlgorithmException ex) {
             logger.error("error generating sso key", ex);
         }
diff --git a/server/src/main/java/com/cloud/user/AccountManager.java b/server/src/main/java/com/cloud/user/AccountManager.java
index eca1a571dd8..84c4650ec4b 100644
--- a/server/src/main/java/com/cloud/user/AccountManager.java
+++ b/server/src/main/java/com/cloud/user/AccountManager.java
@@ -190,6 +190,9 @@ public interface AccountManager extends AccountService, Configurable {
     ConfigKey<Boolean> UseSecretKeyInResponse = new ConfigKey<Boolean>("Advanced", Boolean.class, "use.secret.key.in.response", "false",
             "This parameter allows the users to enable or disable of showing secret key as a part of response for various APIs. By default it is set to false.", true);
 
+    ConfigKey<String> SSOKey = new ConfigKey<>("Secure", String.class, "security.singlesignon.key", null,
+            "A Single Sign-On key used for logging into the cloud", true);
+
     boolean moveUser(long id, Long domainId, Account newAccount);
 
     UserTwoFactorAuthenticator getUserTwoFactorAuthenticator(final Long domainId, final Long userAccountId);
diff --git a/server/src/main/java/com/cloud/user/AccountManagerImpl.java b/server/src/main/java/com/cloud/user/AccountManagerImpl.java
index db9c1d1dafd..4c03ca19237 100644
--- a/server/src/main/java/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/main/java/com/cloud/user/AccountManagerImpl.java
@@ -3109,7 +3109,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     }
 
     private UserAccount getUserAccountForSSO(String username, Long domainId, Map<String, Object[]> requestParameters) {
-        String key = _configDao.getValue("security.singlesignon.key");
+        String key = SSOKey.value();
         if (key == null) {
             // the SSO key is gone, don't authenticate
             return null;
@@ -4101,7 +4101,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     public ConfigKey<?>[] getConfigKeys() {
         return new ConfigKey<?>[] {UseSecretKeyInResponse, enableUserTwoFactorAuthentication,
                 userTwoFactorAuthenticationDefaultProvider, mandateUserTwoFactorAuthentication, userTwoFactorAuthenticationIssuer, apiKeyAccess,
-                userAllowMultipleAccounts, listOfRoleTypesAllowedForOperationsOfSameRoleType, allowOperationsOnUsersInSameAccount};
+                userAllowMultipleAccounts, listOfRoleTypesAllowedForOperationsOfSameRoleType, allowOperationsOnUsersInSameAccount, SSOKey};
     }
 
     public List<UserTwoFactorAuthenticator> getUserTwoFactorAuthenticationProviders() {