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 2014/08/25 17:36:23 UTC

[27/52] git commit: updated refs/heads/saml2 to 1d809ff

utils: Remove hard coded strings from SAMLUtils

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

Branch: refs/heads/saml2
Commit: 7f0fd6764c2ec947b09632a4c9d9abda394b2349
Parents: 2622f41
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Sun Aug 24 17:33:45 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Aug 25 17:33:27 2014 +0200

----------------------------------------------------------------------
 utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f0fd676/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java b/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
index bc39eaf..9c54053 100644
--- a/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
+++ b/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
@@ -19,6 +19,7 @@
 
 package org.apache.cloudstack.utils.auth;
 
+import com.cloud.utils.HttpUtils;
 import org.apache.log4j.Logger;
 import org.joda.time.DateTime;
 import org.opensaml.Configuration;
@@ -85,7 +86,7 @@ public class SAMLUtils {
         NameIDPolicyBuilder nameIdPolicyBuilder = new NameIDPolicyBuilder();
         NameIDPolicy nameIdPolicy = nameIdPolicyBuilder.buildObject();
         nameIdPolicy.setFormat(NameIDType.PERSISTENT);
-        nameIdPolicy.setSPNameQualifier("Apache CloudStack");
+        nameIdPolicy.setSPNameQualifier(spId);
         nameIdPolicy.setAllowCreate(true);
 
         // AuthnContextClass
@@ -113,7 +114,7 @@ public class SAMLUtils {
         authnRequest.setIsPassive(false);
         authnRequest.setIssuer(issuer);
         authnRequest.setIssueInstant(new DateTime());
-        authnRequest.setProviderName("Apache CloudStack");
+        authnRequest.setProviderName(spId);
         authnRequest.setProtocolBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
         authnRequest.setAssertionConsumerServiceURL(consumerUrl);
         authnRequest.setNameIDPolicy(nameIdPolicy);
@@ -136,7 +137,7 @@ public class SAMLUtils {
         deflaterOutputStream.write(requestMessage.getBytes());
         deflaterOutputStream.close();
         String encodedRequestMessage = Base64.encodeBytes(byteArrayOutputStream.toByteArray(), Base64.DONT_BREAK_LINES);
-        encodedRequestMessage = URLEncoder.encode(encodedRequestMessage, "UTF-8").trim();
+        encodedRequestMessage = URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
         return encodedRequestMessage;
     }