mirror of https://github.com/apache/cloudstack.git
Enhanced SSO to allow users to generate the appropriate login request and send that to CloudStack UI. If the Cloudstack UI detects this parameter "loginUrl", it will attempt a single signon process.
This commit is contained in:
parent
fa98eda410
commit
9ac33f8d52
|
|
@ -15,7 +15,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
$.urlParam = function(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (!results) { return 0; } return results[1] || 0;}
|
||||
|
||||
/*
|
||||
This file is meant to help with implementing single signon integration. If you are using the
|
||||
cloud.com default UI, there is no need to touch this file.
|
||||
|
|
@ -37,35 +38,35 @@ var g_loginResponse = null;
|
|||
|
||||
/*
|
||||
For single signon purposes, you just need to make sure that after a successful login, you set the
|
||||
global variable "g_loginResponse"
|
||||
global variable "g_loginResponse"
|
||||
|
||||
You can also pass in a special param called loginUrl that is pregenerated and sent to the CloudStack, it will
|
||||
automatically log you in.
|
||||
|
||||
Below is a sample login attempt
|
||||
*/
|
||||
|
||||
/*
|
||||
$(document).ready(function() {
|
||||
//var username = encodeURIComponent($("#account_username").val());
|
||||
//var password = $("#account_password").val();
|
||||
//var domain = encodeURIComponent($("#account_domain").val());
|
||||
//var url = "/client/api?command=login&username="+username+"&password="+$.md5(password)+"&domain="+domain+"&response=json";
|
||||
$(document).ready(function() {
|
||||
|
||||
// Test URL
|
||||
var url = "/client/api?command=login&username=admin&password=5f4dcc3b5aa765d61d8327deb882cf99&domain=%2F&response=json";
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
g_loginResponse = json.loginresponse;
|
||||
},
|
||||
error: function() {
|
||||
// This means the login failed. You should redirect to your login page.
|
||||
},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var url = $.urlParam("loginUrl");
|
||||
if (url != undefined && url != null && url.length > 0) {
|
||||
url = unescape("/client/api?"+url);
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
g_loginResponse = json.loginresponse;
|
||||
},
|
||||
error: function() {
|
||||
onLogoutCallback();
|
||||
// This means the login failed. You should redirect to your login page.
|
||||
},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$.urlParam = function(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (!results) { return 0; } return results[1] || 0;}
|
||||
|
||||
//***** actions for a tab in right panel (begin) ************************************************************************
|
||||
function buildActionLinkForTab(label, actionMap, $actionMenu, $midmenuItem1, $thisTab) {
|
||||
var apiInfo = actionMap[label];
|
||||
|
|
|
|||
Loading…
Reference in New Issue