Repository: cxf
Updated Branches:
  refs/heads/master 37a9b1f83 -> 5150a2a64


Consolidate some code


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5150a2a6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5150a2a6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5150a2a6

Branch: refs/heads/master
Commit: 5150a2a64943c364d43bc80489c333b0cad9c956
Parents: 37a9b1f
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Fri Apr 25 10:49:11 2014 +0100
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Fri Apr 25 10:49:11 2014 +0100

----------------------------------------------------------------------
 .../sts/token/validator/SAMLTokenValidator.java | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5150a2a6/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
----------------------------------------------------------------------
diff --git 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
index 3bff17a..000f77c 100644
--- 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
+++ 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
@@ -35,6 +35,7 @@ import org.w3c.dom.Element;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.sts.STSConstants;
 import org.apache.cxf.sts.STSPropertiesMBean;
+import org.apache.cxf.sts.cache.CacheUtils;
 import org.apache.cxf.sts.request.ReceivedToken;
 import org.apache.cxf.sts.request.ReceivedToken.STATE;
 import org.apache.cxf.sts.token.realm.CertConstraintsParser;
@@ -331,20 +332,11 @@ public class SAMLTokenValidator implements TokenValidator 
{
                 validTill = 
assertion.getSaml1().getConditions().getNotOnOrAfter();
             }
             
-            SecurityToken securityToken = new SecurityToken(assertion.getId(), 
null, validTill.toDate());
-            securityToken.setToken(assertion.getElement());
-            securityToken.setPrincipal(principal);
-            
-            if (tokenRealm != null) {
-                Properties props = new Properties();
-                props.setProperty(STSConstants.TOKEN_REALM, tokenRealm);
-                securityToken.setProperties(props);
-            }
-
-            int hash = Arrays.hashCode(signatureValue);
-            securityToken.setTokenHash(hash);
-            String identifier = Integer.toString(hash);
-            tokenStore.add(identifier, securityToken);
+            SecurityToken securityToken = 
+                
CacheUtils.createSecurityTokenForStorage(assertion.getElement(), 
assertion.getId(), 
+                    validTill.toDate(), principal, tokenRealm,
+                    null);
+            CacheUtils.storeTokenInCache(securityToken, tokenStore, 
signatureValue);
         }
     }
 

Reply via email to