You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/10/18 13:49:43 UTC

svn commit: r1533405 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java

Author: coheigea
Date: Fri Oct 18 11:49:43 2013
New Revision: 1533405

URL: http://svn.apache.org/r1533405
Log:
Fixed an error when trying to cancel a token

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java?rev=1533405&r1=1533404&r2=1533405&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java Fri Oct 18 11:49:43 2013
@@ -29,7 +29,6 @@ import javax.xml.transform.dom.DOMSource
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.DOMUtils;
@@ -50,6 +49,7 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.bsp.BSPEnforcer;
 import org.apache.wss4j.dom.message.token.Reference;
+import org.apache.wss4j.dom.message.token.SecurityContextToken;
 import org.apache.wss4j.dom.message.token.SecurityTokenReference;
 import org.apache.wss4j.dom.util.WSSecurityUtil;
 import org.apache.wss4j.dom.util.XmlSchemaDateFormat;
@@ -170,9 +170,16 @@ abstract class STSInvoker implements Inv
     }
 
     private SecurityToken findCancelToken(Exchange exchange, Element el) throws WSSecurityException {
-        SecurityTokenReference ref = 
-            new SecurityTokenReference(DOMUtils.getFirstElement(el), new BSPEnforcer());
-        String uri = ref.getReference().getURI();
+        Element childElement = DOMUtils.getFirstElement(el);
+        String uri = "";
+        if ("SecurityContextToken".equals(childElement.getLocalName())) {
+            SecurityContextToken sct = new SecurityContextToken(childElement);
+            uri = sct.getIdentifier();
+        } else {
+            SecurityTokenReference ref = 
+                new SecurityTokenReference(childElement, new BSPEnforcer());
+            uri = ref.getReference().getURI();
+        }
         TokenStore store = (TokenStore)exchange.get(Endpoint.class).getEndpointInfo()
                 .getProperty(TokenStore.class.getName());
         return store.getToken(uri);