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

Signed-off-by: Rohit Yadav <[email protected]>
(cherry picked from commit 6df0b9f677984a85cc50fa964c4ead461f0a3063)
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/77169893
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/77169893
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/77169893

Branch: refs/heads/master
Commit: 77169893441464023422bf1c5786591a46bf1a03
Parents: f543d86
Author: Rohit Yadav <[email protected]>
Authored: Fri Oct 31 00:30:39 2014 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Fri Oct 31 01:24:56 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/77169893/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