cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [9/9] git commit: updated refs/heads/4.5 to b79f13c
Date Fri, 13 Mar 2015 09:32:59 GMT
ui: if session cookie exists, use it to set global session holder and invalidate it

The 19e3c0168e744a76b5e1dc24a5eafa776d342404 commit breaks SAML login and any
login where redirection is used.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b79f13cc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b79f13cc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b79f13cc

Branch: refs/heads/4.5
Commit: b79f13ccb54c6afc48c42bc94c61621dc6cac32d
Parents: 32fe64c
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Mar 13 15:01:11 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri Mar 13 15:01:51 2015 +0530

----------------------------------------------------------------------
 .../api/command/SAML2LoginAPIAuthenticatorCmd.java    |  2 +-
 ui/scripts/cloudStack.js                              | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b79f13cc/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
index d1cc546..f40a4ee 100644
--- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
+++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
@@ -284,7 +284,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements
APIAuthent
                             resp.addCookie(new Cookie("domainid", URLEncoder.encode(loginResponse.getDomainId(),
HttpUtils.UTF_8)));
                             resp.addCookie(new Cookie("role", URLEncoder.encode(loginResponse.getType(),
HttpUtils.UTF_8)));
                             resp.addCookie(new Cookie("username", URLEncoder.encode(loginResponse.getUsername(),
HttpUtils.UTF_8)));
-                            resp.addCookie(new Cookie("sessionKey", URLEncoder.encode(loginResponse.getSessionKey(),
HttpUtils.UTF_8)));
+                            resp.addCookie(new Cookie("sessionkey", URLEncoder.encode(loginResponse.getSessionKey(),
HttpUtils.UTF_8)));
                             resp.addCookie(new Cookie("account", URLEncoder.encode(loginResponse.getAccount(),
HttpUtils.UTF_8)));
                             resp.addCookie(new Cookie("timezone", URLEncoder.encode(loginResponse.getTimeZone(),
HttpUtils.UTF_8)));
                             resp.addCookie(new Cookie("userfullname", URLEncoder.encode(loginResponse.getFirstName()
+ " " + loginResponse.getLastName(), HttpUtils.UTF_8).replace("+", "%20")));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b79f13cc/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 19d6bd0..479b162 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -117,14 +117,22 @@
                         }
                         return cookieValue;
                     };
-                    g_sessionKey = unBoxCookieValue('JSESSIONID');
+                    unBoxCookieValue('sessionkey');
+                    // if sessionkey cookie exists use this to set g_sessionKey
+                    // and destroy sessionkey cookie
+                    if ($.cookie('sessionkey')) {
+                        g_sessionKey = $.cookie('sessionkey');
+                        $.cookie('sessionkey', null);
+                    } else {
+                        g_sessionKey = unBoxCookieValue('JSESSIONID');
+                    }
                     g_role = unBoxCookieValue('role');
                     g_userid = unBoxCookieValue('userid');
                     g_domainid = unBoxCookieValue('domainid');
                     g_account = unBoxCookieValue('account');
                     g_username = unBoxCookieValue('username');
                     g_userfullname = unBoxCookieValue('userfullname');
-                    g_timezone = unBoxCookieValue('timezone');                    
+                    g_timezone = unBoxCookieValue('timezone');
                 } else { //single-sign-on	(bypass login screen)
                     g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
                     g_role = g_loginResponse.type;
@@ -322,6 +330,7 @@
                         g_loginCmdText = null;
                         
                         $.cookie('JSESSIONID', null);
+                        $.cookie('sessionkey', null);
                         $.cookie('username', null);
                         $.cookie('account', null);
                         $.cookie('domainid', null);
@@ -345,6 +354,7 @@
 
             samlLoginAction: function(args) {
                 $.cookie('JSESSIONID', null);
+                $.cookie('sessionkey', null);
                 $.cookie('username', null);
                 $.cookie('account', null);
                 $.cookie('domainid', null);


Mime
View raw message