ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1299255 - in /webservices/wss4j/branches/swssf: streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/ streaming-xml-security/src/main/java/org/swssf/xm...
Date Sat, 10 Mar 2012 19:14:28 GMT
Author: giger
Date: Sat Mar 10 19:14:27 2012
New Revision: 1299255

URL: http://svn.apache.org/viewvc?rev=1299255&view=rev
Log:
Set responsible XMLEvent for a token; Will be needed for policy verification

Modified:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DerivedKeyTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityContextTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/AbstractSecurityToken.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/SecurityToken.java

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -53,6 +53,7 @@ public class BinarySecurityTokenInputHan
         }
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
@@ -77,6 +78,7 @@ public class BinarySecurityTokenInputHan
                         crypto,
                         securityProperties.getCallbackHandler());
                 this.binarySecurityToken.setElementPath(elementPath);
+                this.binarySecurityToken.setXMLEvent(responsibleStartXMLEvent);
                 return this.binarySecurityToken;
             }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DerivedKeyTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DerivedKeyTokenInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DerivedKeyTokenInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DerivedKeyTokenInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -64,6 +64,7 @@ public class DerivedKeyTokenInputHandler
         }
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
@@ -151,6 +152,7 @@ public class DerivedKeyTokenInputHandler
                     }
                 };
                 this.derivedKeySecurityToken.setElementPath(elementPath);
+                this.derivedKeySecurityToken.setXMLEvent(responsibleStartXMLEvent);
                 return this.derivedKeySecurityToken;
             }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -63,6 +63,7 @@ public class EncryptedKeyInputHandler ex
         }
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
@@ -171,6 +172,7 @@ public class EncryptedKeyInputHandler ex
                     }
                 };
                 this.securityToken.setElementPath(elementPath);
+                this.securityToken.setXMLEvent(responsibleStartXMLEvent);
                 return this.securityToken;
             }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -72,6 +72,7 @@ public class SAMLTokenInputHandler exten
         }
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
@@ -89,6 +90,7 @@ public class SAMLTokenInputHandler exten
                         securityProperties.getCallbackHandler(), samlAssertionWrapper.getId(),
null);
 
                 this.securityToken.setElementPath(elementPath);
+                this.securityToken.setXMLEvent(responsibleStartXMLEvent);
                 return this.securityToken;
             }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityContextTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityContextTokenInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityContextTokenInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityContextTokenInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -59,6 +59,7 @@ public class SecurityContextTokenInputHa
                 new QName(securityContextTokenTypeJAXBElement.getName().getNamespaceURI(),
WSSConstants.TAG_wsc0502_Identifier.getLocalPart()));
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         final WSSecurityToken securityContextToken =
                 new AbstractSecurityToken(
@@ -94,6 +95,7 @@ public class SecurityContextTokenInputHa
                     }
                 };
         securityContextToken.setElementPath(elementPath);
+        securityContextToken.setXMLEvent(responsibleStartXMLEvent);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.java
Sat Mar 10 19:14:27 2012
@@ -181,6 +181,7 @@ public class UsernameTokenInputHandler e
         final String password = passwordType.getValue();
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(),
eventQueue);
+        final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue,
index);
 
         SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
@@ -193,6 +194,7 @@ public class UsernameTokenInputHandler e
                 this.securityToken = SecurityTokenFactoryImpl.getSecurityToken(username.getValue(),
password,
                         created, nonceVal, salt, iteration, (WSSecurityContext) inputProcessorChain.getSecurityContext(),
usernameTokenType.getId());
                 this.securityToken.setElementPath(elementPath);
+                this.securityToken.setXMLEvent(responsibleStartXMLEvent);
                 return this.securityToken;
             }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/AbstractSecurityToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/AbstractSecurityToken.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/AbstractSecurityToken.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/AbstractSecurityToken.java
Sat Mar 10 19:14:27 2012
@@ -31,6 +31,7 @@ import org.swssf.xmlsec.ext.XMLSecurityE
 import javax.crypto.SecretKey;
 import javax.security.auth.callback.CallbackHandler;
 import javax.xml.namespace.QName;
+import javax.xml.stream.events.XMLEvent;
 import java.security.Key;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
@@ -57,6 +58,7 @@ public abstract class AbstractSecurityTo
     private String id;
     private Object processor;
     private List<QName> elementPath;
+    private XMLEvent xmlEvent;
     private WSSConstants.KeyIdentifierType keyIdentifierType;
     private List<SecurityToken> wrappedTokens;
     private List<TokenUsage> tokenUsages = new ArrayList<TokenUsage>();
@@ -112,6 +114,16 @@ public abstract class AbstractSecurityTo
         this.elementPath = Collections.unmodifiableList(elementPath);
     }
 
+    @Override
+    public XMLEvent getXMLEvent() {
+        return xmlEvent;
+    }
+
+    @Override
+    public void setXMLEvent(XMLEvent xmlEvent) {
+        this.xmlEvent = xmlEvent;
+    }
+
     public Crypto getCrypto() {
         return crypto;
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.java
Sat Mar 10 19:14:27 2012
@@ -28,6 +28,7 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.events.XMLEvent;
 import java.util.ArrayList;
 import java.util.Deque;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -63,4 +64,13 @@ public abstract class AbstractInputSecur
         }
         return elementPath;
     }
+
+    protected XMLEvent getResponsibleStartXMLEvent(Deque<XMLEvent> eventDeque, int
index) {
+        Iterator<XMLEvent> xmlEventIterator = eventDeque.descendingIterator();
+        int curIdx = 0;
+        while (curIdx++ < index) {
+            xmlEventIterator.next();
+        }
+        return xmlEventIterator.next();
+    }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/SecurityToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/SecurityToken.java?rev=1299255&r1=1299254&r2=1299255&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/SecurityToken.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/SecurityToken.java
Sat Mar 10 19:14:27 2012
@@ -19,6 +19,7 @@
 package org.swssf.xmlsec.ext;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.events.XMLEvent;
 import java.security.Key;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
@@ -73,6 +74,13 @@ public interface SecurityToken {
     List<QName> getElementPath();
 
     /**
+     * Returns the first XMLEvent for this token
+     *
+     * @return
+     */
+    XMLEvent getXMLEvent();
+
+    /**
      * Returns the token type
      *
      * @return true if asymmetric token, false if symmetric token



Mime
View raw message