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

sureshanaparti pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.22 by this push:
     new d6c39772b21 Set management server id from cookies after saml login 
(#12858)
d6c39772b21 is described below

commit d6c39772b2177c9fde87780611f33a52902d4395
Author: Suresh Kumar Anaparti <[email protected]>
AuthorDate: Wed Mar 25 20:52:44 2026 +0530

    Set management server id from cookies after saml login (#12858)
---
 .../saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java      | 3 +++
 ui/src/permission.js                                                   | 1 +
 2 files changed, 4 insertions(+)

diff --git 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
index 1a9d677d43a..135e1290f08 100644
--- 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
+++ 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
@@ -335,6 +335,9 @@ public class SAMLUtils {
         resp.addCookie(newCookie(domain, path,"isSAML", 
URLEncoder.encode("true", HttpUtils.UTF_8)));
         resp.addCookie(newCookie(domain, path,"twoFaEnabled", 
URLEncoder.encode(loginResponse.is2FAenabled(), HttpUtils.UTF_8)));
         resp.addCookie(newCookie(domain, path,"userfullname", 
URLEncoder.encode(loginResponse.getFirstName() + " " + 
loginResponse.getLastName(), HttpUtils.UTF_8).replace("+", "%20")));
+        if (StringUtils.isNotBlank(loginResponse.getManagementServerId())) {
+            resp.addCookie(new Cookie(ApiConstants.MANAGEMENT_SERVER_ID, 
URLEncoder.encode(loginResponse.getManagementServerId(), HttpUtils.UTF_8)));
+        }
     }
 
     private static Cookie newCookie(final String domain, final String path, 
final String name, final String value) {
diff --git a/ui/src/permission.js b/ui/src/permission.js
index 266dc992c8d..eeb36c57117 100644
--- a/ui/src/permission.js
+++ b/ui/src/permission.js
@@ -93,6 +93,7 @@ router.beforeEach((to, from, next) => {
           return
         }
         store.commit('SET_LOGIN_FLAG', true)
+        store.commit('SET_MS_ID', Cookies.get('managementserverid'))
       }
       if (Object.keys(store.getters.apis).length === 0) {
         const cachedApis = vueProps.$localStorage.get(APIS, {})

Reply via email to