SAMLUtils: SAML user id should fit within the UUID VARCHAR(40) column

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6df0b9f6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6df0b9f6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6df0b9f6

Branch: refs/heads/4.5
Commit: 6df0b9f677984a85cc50fa964c4ead461f0a3063
Parents: cd52bed
Author: Rohit Yadav <[email protected]>
Authored: Fri Oct 31 00:30:39 2014 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Fri Oct 31 00:39:20 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6df0b9f6/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 36c4d0f..d129309 100644
--- a/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
+++ b/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java
@@ -102,7 +102,8 @@ public class SAMLUtils {
     public static final String CERTIFICATE_NAME = "SAMLSP_CERTIFICATE";
 
     public static String createSAMLId(String uid) {
-        return SAML_NS + uid;
+        String samlUuid = SAML_NS + uid;
+        return samlUuid.length() > 40 ? samlUuid.substring(0, 40) : samlUuid;
     }
 
     public static Boolean checkSAMLUserId(String uuid) {

Reply via email to