cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1210459 - in /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator: SAMLTokenValidator.java UsernameTokenValidator.java
Date Mon, 05 Dec 2011 13:45:26 GMT
Author: coheigea
Date: Mon Dec  5 13:45:26 2011
New Revision: 1210459

URL: http://svn.apache.org/viewvc?rev=1210459&view=rev
Log:
Some fixes wrt caching in the STS TokenValidators

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java?rev=1210459&r1=1210458&r2=1210459&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
Mon Dec  5 13:45:26 2011
@@ -196,6 +196,9 @@ public class SAMLTokenValidator implemen
             }
             if (!(validFrom.isBeforeNow() && validTill.isAfterNow())) {
                 LOG.log(Level.WARNING, "SAML Token condition not met");
+                if (secToken != null) {
+                    tokenParameters.getTokenStore().remove(secToken);
+                }
                 return response;
             }
             

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java?rev=1210459&r1=1210458&r2=1210459&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
Mon Dec  5 13:45:26 2011
@@ -135,28 +135,24 @@ public class UsernameTokenValidator impl
         if (tokenParameters.getTokenStore() != null) {
             secToken = tokenParameters.getTokenStore().getToken(usernameTokenType.getId());
         }
-        
-        Element rootElement = null;
+
+        // Marshall the received JAXB object into a DOM Element
         Element usernameTokenElement = null;
-        if (secToken == null) {
-            try {
-                JAXBContext jaxbContext = 
-                    JAXBContext.newInstance("org.apache.cxf.ws.security.sts.provider.model");
-                Marshaller marshaller = jaxbContext.createMarshaller();
-                Document doc = DOMUtils.createDocument();
-                rootElement = doc.createElement("root-element");
-                JAXBElement<UsernameTokenType> tokenType = 
-                    new JAXBElement<UsernameTokenType>(
-                        QNameConstants.USERNAME_TOKEN, UsernameTokenType.class, usernameTokenType
-                    );
-                marshaller.marshal(tokenType, rootElement);
-            } catch (JAXBException ex) {
-                LOG.log(Level.WARNING, "", ex);
-                return response;
-            }
+        try {
+            JAXBContext jaxbContext = 
+                JAXBContext.newInstance("org.apache.cxf.ws.security.sts.provider.model");
+            Marshaller marshaller = jaxbContext.createMarshaller();
+            Document doc = DOMUtils.createDocument();
+            Element rootElement = doc.createElement("root-element");
+            JAXBElement<UsernameTokenType> tokenType = 
+                new JAXBElement<UsernameTokenType>(
+                    QNameConstants.USERNAME_TOKEN, UsernameTokenType.class, usernameTokenType
+                );
+            marshaller.marshal(tokenType, rootElement);
             usernameTokenElement = (Element)rootElement.getFirstChild();
-        } else {
-            usernameTokenElement = secToken.getToken();
+        } catch (JAXBException ex) {
+            LOG.log(Level.WARNING, "", ex);
+            return response;
         }
         
         //



Mime
View raw message