You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/06/05 18:02:50 UTC
git commit: updated refs/heads/saml-production-grade to 6b94e89
Repository: cloudstack
Updated Branches:
refs/heads/saml-production-grade 001237312 -> 6b94e89c1
CLOUDSTACK-8462: UI should allow users to pass in domain they want to log into
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6b94e89c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6b94e89c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6b94e89c
Branch: refs/heads/saml-production-grade
Commit: 6b94e89c14984e9782b08236f4dced90a3607d08
Parents: 0012373
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri Jun 5 18:01:31 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Jun 5 18:02:35 2015 +0200
----------------------------------------------------------------------
client/tomcatconf/commands.properties.in | 1 +
.../org/apache/cloudstack/api/command/ListIdpsCmd.java | 9 ++++++---
ui/index.jsp | 11 +++++++----
ui/scripts/cloudStack.js | 9 ++++++++-
ui/scripts/ui-custom/login.js | 12 ++++++++++--
5 files changed, 32 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b94e89c/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index a87d167..2cd99c5 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -26,6 +26,7 @@ logout=15
samlSso=15
samlSlo=15
getSPMetadata=15
+listIdps=15
### Account commands
createAccount=7
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b94e89c/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java
index d6d867c..3771a95 100644
--- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java
+++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListIdpsCmd.java
@@ -76,12 +76,15 @@ public class ListIdpsCmd extends BaseCmd implements APIAuthenticator {
ListResponse<IdpResponse> response = new ListResponse<IdpResponse>();
List<IdpResponse> idpResponseList = new ArrayList<IdpResponse>();
for (SAMLProviderMetadata metadata: _samlAuthManager.getAllIdPMetadata()) {
+ if (metadata == null) {
+ continue;
+ }
IdpResponse idpResponse = new IdpResponse();
idpResponse.setId(metadata.getEntityId());
- if (metadata.getOrganizationName() != null || !metadata.getOrganizationName().isEmpty()) {
- idpResponse.setOrgName(metadata.getOrganizationName());
- } else {
+ if (metadata.getOrganizationName() == null || metadata.getOrganizationName().isEmpty()) {
idpResponse.setOrgName(metadata.getEntityId());
+ } else {
+ idpResponse.setOrgName(metadata.getOrganizationName());
}
idpResponse.setOrgUrl(metadata.getOrganizationUrl());
idpResponse.setObjectName("idp");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b94e89c/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index fa2ef24..6874769 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -68,11 +68,14 @@
</div>
<!-- Submit (login) -->
<input type="submit" value="<fmt:message key="label.login"/>" /><br />
+ <!-- SAML login elements -->
<div id="saml-login" style="margin-top: 30px">
- <select id="saml-idps">
- <option value=""></option> <!-- when this blank option is selected, default IdP will be used -->
- </select>
- <input type="samlsubmit" value="<fmt:message key="label.saml.login"/>"/>
+ <select id="saml-idps"></select>
+ <div class="field domain">
+ <label for="domain"><fmt:message key="label.domain"/></label>
+ <input id="saml-domain" type="text" name="saml-domain" style="width: 175px; display: inline;"/>
+ <input id="saml-submit" style="display: inline" type="samlsubmit" value="<fmt:message key="label.saml.login"/>"/>
+ </div>
</div>
<!-- Select language -->
<div class="select-language">
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b94e89c/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 28be71c..8a3fd26 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -371,7 +371,14 @@
$.cookie('domainid', null);
$.cookie('role', null);
$.cookie('timezone', null);
- window.location.href = createURL('samlSso&idpid=' + args.data.idpid);
+ var url = 'samlSso';
+ if (args.data.idpid) {
+ url = url + '&idpid=' + args.data.idpid;
+ }
+ if (args.data.domain) {
+ url = url + '&domain=' + args.data.domain;
+ }
+ window.location.href = createURL(url);
},
// Show cloudStack main UI widget
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b94e89c/ui/scripts/ui-custom/login.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/login.js b/ui/scripts/ui-custom/login.js
index 90a19ab..7f32e13 100644
--- a/ui/scripts/ui-custom/login.js
+++ b/ui/scripts/ui-custom/login.js
@@ -121,9 +121,10 @@
});
// SAML Login action
- $login.find('input[type=samlsubmit]').click(function() {
+ $login.find('#saml-submit').click(function() {
args.samlLoginAction({
- data: {'idpid': $login.find('#saml-idps').find(':selected').val()}
+ data: {'idpid': $login.find('#saml-idps').find(':selected').val(),
+ 'domain': $login.find('#saml-domain').val()}
});
});
@@ -143,6 +144,13 @@
var idpList = data.listidpsresponse.idp.sort(function (a, b) {
return a.orgName.localeCompare(b.orgName);
});
+ if (idpList.length > 1) {
+ $login.find('#saml-idps')
+ .append($('<option>', {
+ value: '',
+ text: ''
+ }));
+ }
$.each(idpList, function(index, idp) {
$login.find('#saml-idps')
.append($('<option>', {