mirror of https://github.com/apache/cloudstack.git
ui: if session cookie exists, use it to set global session holder and invalidate it
The19e3c0168ecommit breaks SAML login and any login where redirection is used. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> (cherry picked from commitb79f13ccb5) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
2f1863cae0
commit
6c71d3bae1
|
|
@ -285,7 +285,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")));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue