cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/saml-production-grade to d3f43fd
Date Fri, 05 Jun 2015 16:08:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/saml-production-grade 6b94e89c1 -> d3f43fd79 (forced update)


CLOUDSTACK-8462: UI should allow users to pass in domain they want to log into

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/d3f43fd7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d3f43fd7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d3f43fd7

Branch: refs/heads/saml-production-grade
Commit: d3f43fd79c61016801bf828b140eabd3851e2725
Parents: 0012373
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Jun 5 18:01:31 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri Jun 5 18:08:22 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/d3f43fd7/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/d3f43fd7/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/d3f43fd7/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index fa2ef24..17c5ec4 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="saml-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/d3f43fd7/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/d3f43fd7/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>', {


Mime
View raw message