You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by gi...@apache.org on 2012/03/15 21:53:48 UTC
svn commit: r1301193 - in /webservices/wss4j/branches/swssf:
streaming-ws-policy/src/main/java/org/swssf/policy/
streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/
streaming-ws-policy/src/test/java/org/swssf/policy/test/ streaming-ws-s...
Author: giger
Date: Thu Mar 15 20:53:47 2012
New Revision: 1301193
URL: http://svn.apache.org/viewvc?rev=1301193&view=rev
Log:
reference corresponding assertions from the WSP1.3 Spec.
more tests in the tokenAssertion classes per spec.
Modified:
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ContentEncryptedElementsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedElementsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedPartsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/HttpsTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KerberosTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KeyValueTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RelTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredElementsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredPartsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SamlTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecureConversationTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecurityContextTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedElementsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedPartsAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SpnegoContextTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/UsernameTokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/X509TokenAssertionState.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/KerberosTokenTest.java
webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/RelTokenTest.java
webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KerberosTokenSecurityEvent.java
webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KeyValueTokenSecurityEvent.java
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java Thu Mar 15 20:53:47 2012
@@ -175,14 +175,21 @@ public class PolicyEnforcer implements S
protected List<Assertable> getAssertableForAssertion(AbstractSecurityAssertion abstractSecurityAssertion) throws WSSPolicyException {
List<Assertable> assertableList = new LinkedList<Assertable>();
if (abstractSecurityAssertion instanceof ContentEncryptedElements) {
+ //initialized with asserted=true because it could be that parent elements are encrypted and therefore these element are also encrypted
+ //the test if it is really encrypted is done via the PolicyInputProcessor which emits EncryptedElementEvents for unencrypted elements with the unencrypted flag
assertableList.add(new ContentEncryptedElementsAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof EncryptedParts) {
+ //initialized with asserted=true with the same reason as by the EncryptedParts above
assertableList.add(new EncryptedPartsAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof EncryptedElements) {
+ //initialized with asserted=true with the same reason as by the EncryptedParts above
assertableList.add(new EncryptedElementsAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof SignedParts) {
+ //initialized with asserted=true because it could be that parent elements are signed and therefore these element are also signed
+ //the test if it is really signed is done via the PolicyInputProcessor which emits SignedElementEvents for unsigned elements with the unsigned flag
assertableList.add(new SignedPartsAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof SignedElements) {
+ //initialized with asserted=true with the same reason as by the SignedParts above
assertableList.add(new SignedElementsAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof RequiredElements) {
assertableList.add(new RequiredElementsAssertionState(abstractSecurityAssertion, false));
@@ -211,6 +218,7 @@ public class PolicyEnforcer implements S
} else if (abstractSecurityAssertion instanceof KeyValueToken) {
assertableList.add(new KeyValueTokenAssertionState(abstractSecurityAssertion, false));
} else if (abstractSecurityAssertion instanceof AlgorithmSuite) {
+ //initialized with asserted=true because we do negative matching
assertableList.add(new AlgorithmSuiteAssertionState(abstractSecurityAssertion, true));
} else if (abstractSecurityAssertion instanceof AsymmetricBinding) {
} else if (abstractSecurityAssertion instanceof SymmetricBinding) {
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java Thu Mar 15 20:53:47 2012
@@ -54,6 +54,8 @@ public class PolicyInputProcessor extend
XMLEvent xmlEvent = inputProcessorChain.processHeaderEvent();
//test if non encrypted element have to be encrypted per policy
boolean transportSecurityActive = Boolean.TRUE == inputProcessorChain.getSecurityContext().get(WSSConstants.TRANSPORT_SECURITY_ACTIVE);
+ //if transport security is active, every element is encrypted/signed
+ //WSP1.3, 4.2.1 EncryptedParts Assertion
if (!transportSecurityActive
&& !inputProcessorChain.getDocumentContext().isInEncryptedContent()
&& ((WSSDocumentContext) inputProcessorChain.getDocumentContext()).isInSecurityHeader()) {
@@ -98,7 +100,8 @@ public class PolicyInputProcessor extend
}
boolean transportSecurityActive = Boolean.TRUE == inputProcessorChain.getSecurityContext().get(WSSConstants.TRANSPORT_SECURITY_ACTIVE);
-
+ //if transport security is active, every element is encrypted/signed
+ //WSP1.3, 4.2.1 EncryptedParts Assertion
//test if non encrypted element have to be encrypted per policy
if (!transportSecurityActive
&& !inputProcessorChain.getDocumentContext().isInEncryptedContent()
@@ -106,6 +109,8 @@ public class PolicyInputProcessor extend
testEncryptionPolicy(xmlEvent, inputProcessorChain);
}
+ //if transport security is active, every element is encrypted/signed
+ //WSP1.3, 4.1.1 SignedParts Assertion
//test if non signed element have to be signed per policy
if (!transportSecurityActive
&& !inputProcessorChain.getDocumentContext().isInSignedContent()) {
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ContentEncryptedElementsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ContentEncryptedElementsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ContentEncryptedElementsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ContentEncryptedElementsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -35,6 +35,8 @@ import java.util.Iterator;
import java.util.List;
/**
+ * WSP1.3, 4.2.3 ContentEncryptedElements Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedElementsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedElementsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedElementsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedElementsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -35,6 +35,8 @@ import java.util.Iterator;
import java.util.List;
/**
+ * WSP1.3, 4.2.2 EncryptedElements Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedPartsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedPartsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedPartsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/EncryptedPartsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -34,6 +34,8 @@ import java.util.LinkedList;
import java.util.List;
/**
+ * WSP1.3, 4.2.1 EncryptedParts Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/HttpsTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/HttpsTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/HttpsTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/HttpsTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -27,6 +27,8 @@ import org.swssf.wss.securityEvent.Secur
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.10 HttpsToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -49,6 +51,7 @@ public class HttpsTokenAssertionState ex
if (!(tokenSecurityEvent instanceof HttpsTokenSecurityEvent)) {
throw new WSSPolicyException("Expected a HttpsTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
}
+
HttpsTokenSecurityEvent httpsTokenSecurityEvent = (HttpsTokenSecurityEvent) tokenSecurityEvent;
HttpsToken httpsToken = (HttpsToken) abstractToken;
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KerberosTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KerberosTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KerberosTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KerberosTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -21,11 +21,14 @@ package org.swssf.policy.assertionStates
import org.apache.ws.secpolicy.WSSPolicyException;
import org.apache.ws.secpolicy.model.AbstractSecurityAssertion;
import org.apache.ws.secpolicy.model.AbstractToken;
+import org.apache.ws.secpolicy.model.KerberosToken;
import org.swssf.wss.securityEvent.KerberosTokenSecurityEvent;
import org.swssf.wss.securityEvent.SecurityEvent;
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.4 KerberosToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -50,6 +53,31 @@ public class KerberosTokenAssertionState
}
setAsserted(true);
+
+ KerberosToken kerberosToken = (KerberosToken) abstractToken;
+ KerberosTokenSecurityEvent kerberosTokenSecurityEvent = (KerberosTokenSecurityEvent) tokenSecurityEvent;
+ if (kerberosToken.getIssuerName() != null) {
+ if (!kerberosToken.getIssuerName().equals(kerberosTokenSecurityEvent.getIssuerName())) {
+ setAsserted(false);
+ setErrorMessage("IssuerName in Policy (" + kerberosToken.getIssuerName() + ") didn't match with the one in the IssuedToken (" + kerberosTokenSecurityEvent.getIssuerName() + ")");
+ }
+ }
+ if (kerberosToken.getApReqTokenType() != null) {
+ switch (kerberosToken.getApReqTokenType()) {
+ case WssKerberosV5ApReqToken11:
+ if (!kerberosTokenSecurityEvent.isKerberosV5ApReqToken11()) {
+ setAsserted(false);
+ setErrorMessage("Policy enforces " + kerberosToken.getApReqTokenType());
+ }
+ break;
+ case WssGssKerberosV5ApReqToken11:
+ if (!kerberosTokenSecurityEvent.isGssKerberosV5ApReqToken11()) {
+ setAsserted(false);
+ setErrorMessage("Policy enforces " + kerberosToken.getApReqTokenType());
+ }
+ break;
+ }
+ }
//todo
return isAsserted();
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KeyValueTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KeyValueTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KeyValueTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/KeyValueTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -21,11 +21,14 @@ package org.swssf.policy.assertionStates
import org.apache.ws.secpolicy.WSSPolicyException;
import org.apache.ws.secpolicy.model.AbstractSecurityAssertion;
import org.apache.ws.secpolicy.model.AbstractToken;
+import org.apache.ws.secpolicy.model.KeyValueToken;
import org.swssf.wss.securityEvent.KeyValueTokenSecurityEvent;
import org.swssf.wss.securityEvent.SecurityEvent;
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.11 KeyValueToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -49,7 +52,14 @@ public class KeyValueTokenAssertionState
throw new WSSPolicyException("Expected a KeyValueTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
}
setAsserted(true);
- //todo
+
+ KeyValueTokenSecurityEvent keyValueTokenSecurityEvent = (KeyValueTokenSecurityEvent) tokenSecurityEvent;
+ KeyValueToken keyValueToken = (KeyValueToken) abstractToken;
+ if (keyValueToken.isRsaKeyValue() && !keyValueTokenSecurityEvent.hasRsaKeyValue()) {
+ setAsserted(false);
+ setErrorMessage("Policy enforces that a RsaKeyValue must be present in the KeyValueToken");
+ }
+
return isAsserted();
}
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RelTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RelTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RelTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RelTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -21,11 +21,14 @@ package org.swssf.policy.assertionStates
import org.apache.ws.secpolicy.WSSPolicyException;
import org.apache.ws.secpolicy.model.AbstractSecurityAssertion;
import org.apache.ws.secpolicy.model.AbstractToken;
+import org.apache.ws.secpolicy.model.RelToken;
import org.swssf.wss.securityEvent.RelTokenSecurityEvent;
import org.swssf.wss.securityEvent.SecurityEvent;
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.9 RelToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -49,8 +52,19 @@ public class RelTokenAssertionState exte
throw new WSSPolicyException("Expected a RelTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
}
+ RelTokenSecurityEvent relTokenSecurityEvent = (RelTokenSecurityEvent) tokenSecurityEvent;
+ RelToken relToken = (RelToken) abstractToken;
+
setAsserted(true);
- //todo
+
+ if (relToken.getIssuerName() != null && !relToken.getIssuerName().equals(relTokenSecurityEvent.getIssuerName())) {
+ setAsserted(false);
+ setErrorMessage("IssuerName in Policy (" + relToken.getIssuerName() + ") didn't match with the one in the RelToken (" + relTokenSecurityEvent.getIssuerName() + ")");
+ }
+
+ //todo RequireKeyIdentifierReference
+ //todo WssRelV*
+
return isAsserted();
}
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredElementsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredElementsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredElementsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredElementsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -36,6 +36,8 @@ import java.util.List;
import java.util.Map;
/**
+ * WSP1.3, 4.3.1 RequiredElements Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredPartsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredPartsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredPartsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/RequiredPartsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -33,6 +33,8 @@ import javax.xml.namespace.QName;
import java.util.*;
/**
+ * WSP1.3, 4.3.2 RequiredParts Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SamlTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SamlTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SamlTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SamlTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -31,6 +31,8 @@ import org.swssf.wss.securityEvent.Token
import org.swssf.xmlsec.ext.XMLSecurityException;
/**
+ * WSP1.3, 5.4.8 SamlToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecureConversationTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecureConversationTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecureConversationTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecureConversationTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -27,6 +27,8 @@ import org.swssf.wss.securityEvent.Secur
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.7 SecureConversationToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -53,7 +55,7 @@ public class SecureConversationTokenAsse
SecureConversationToken secureConversationToken = (SecureConversationToken) abstractToken;
setAsserted(true);
- //todo move to super-class?
+
if (secureConversationToken.getIssuerName() != null && !secureConversationToken.getIssuerName().equals(secureConversationSecurityEvent.getIssuerName())) {
setAsserted(false);
setErrorMessage("IssuerName in Policy (" + secureConversationToken.getIssuerName() + ") didn't match with the one in the SecureConversationToken (" + secureConversationSecurityEvent.getIssuerName() + ")");
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecurityContextTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecurityContextTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecurityContextTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SecurityContextTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -27,6 +27,8 @@ import org.swssf.wss.securityEvent.Secur
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.6 SecurityContextToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -53,7 +55,7 @@ public class SecurityContextTokenAsserti
SecurityContextToken securityContextToken = (SecurityContextToken) abstractToken;
setAsserted(true);
- //todo move issuerName to superClass?
+
if (securityContextToken.getIssuerName() != null && !securityContextToken.getIssuerName().equals(securityContextTokenSecurityEvent.getIssuerName())) {
setAsserted(false);
setErrorMessage("IssuerName in Policy (" + securityContextToken.getIssuerName() + ") didn't match with the one in the SecurityContextToken (" + securityContextTokenSecurityEvent.getIssuerName() + ")");
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedElementsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedElementsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedElementsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedElementsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -35,6 +35,8 @@ import java.util.Iterator;
import java.util.List;
/**
+ * WSP1.3, 4.1.2 SignedElements Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedPartsAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedPartsAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedPartsAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SignedPartsAssertionState.java Thu Mar 15 20:53:47 2012
@@ -34,6 +34,8 @@ import java.util.LinkedList;
import java.util.List;
/**
+ * WSP1.3, 4.1.1 SignedParts Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SpnegoContextTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SpnegoContextTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SpnegoContextTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/SpnegoContextTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -21,11 +21,14 @@ package org.swssf.policy.assertionStates
import org.apache.ws.secpolicy.WSSPolicyException;
import org.apache.ws.secpolicy.model.AbstractSecurityAssertion;
import org.apache.ws.secpolicy.model.AbstractToken;
+import org.apache.ws.secpolicy.model.SpnegoContextToken;
import org.swssf.wss.securityEvent.SecurityEvent;
import org.swssf.wss.securityEvent.SpnegoContextTokenSecurityEvent;
import org.swssf.wss.securityEvent.TokenSecurityEvent;
/**
+ * WSP1.3, 5.4.5 SpnegoContextToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
@@ -49,7 +52,10 @@ public class SpnegoContextTokenAssertion
throw new WSSPolicyException("Expected a SpnegoContextTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
}
setAsserted(true);
- //todo
+
+ SpnegoContextToken spnegoContextToken = (SpnegoContextToken) abstractToken;
+ SpnegoContextTokenSecurityEvent spnegoContextTokenSecurityEvent = (SpnegoContextTokenSecurityEvent) tokenSecurityEvent;
+ //todo MustNotSend*
return isAsserted();
}
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/UsernameTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/UsernameTokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/UsernameTokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/UsernameTokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -30,6 +30,8 @@ import org.swssf.wss.securityEvent.Usern
import org.swssf.xmlsec.ext.XMLSecurityException;
/**
+ * WSP1.3, 5.4.1 UsernameToken Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/X509TokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/X509TokenAssertionState.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/X509TokenAssertionState.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/X509TokenAssertionState.java Thu Mar 15 20:53:47 2012
@@ -33,6 +33,8 @@ import org.swssf.xmlsec.ext.XMLSecurityE
import java.security.cert.X509Certificate;
/**
+ * WSP1.3, 5.4.3 X509Token Assertion
+ *
* @author $Author$
* @version $Revision$ $Date$
*/
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/KerberosTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/KerberosTokenTest.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/KerberosTokenTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/KerberosTokenTest.java Thu Mar 15 20:53:47 2012
@@ -75,6 +75,7 @@ public class KerberosTokenTest extends A
policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
KerberosTokenSecurityEvent recipientTokenSecurityEvent = new KerberosTokenSecurityEvent();
+ recipientTokenSecurityEvent.setIssuerName("xs:anyURI");
securityToken = getX509Token(WSSConstants.X509V3Token);
securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
recipientTokenSecurityEvent.setSecurityToken(securityToken);
Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/RelTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/RelTokenTest.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/RelTokenTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/java/org/swssf/policy/test/RelTokenTest.java Thu Mar 15 20:53:47 2012
@@ -68,12 +68,14 @@ public class RelTokenTest extends Abstra
PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
RelTokenSecurityEvent initiatorTokenSecurityEvent = new RelTokenSecurityEvent();
+ initiatorTokenSecurityEvent.setIssuerName("xs:anyURI");
SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
initiatorTokenSecurityEvent.setSecurityToken(securityToken);
policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
RelTokenSecurityEvent recipientTokenSecurityEvent = new RelTokenSecurityEvent();
+ recipientTokenSecurityEvent.setIssuerName("xs:anyURI");
securityToken = getX509Token(WSSConstants.X509V3Token);
securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
recipientTokenSecurityEvent.setSecurityToken(securityToken);
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KerberosTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KerberosTokenSecurityEvent.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KerberosTokenSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KerberosTokenSecurityEvent.java Thu Mar 15 20:53:47 2012
@@ -37,4 +37,14 @@ public class KerberosTokenSecurityEvent
public void setIssuerName(String issuerName) {
this.issuerName = issuerName;
}
+
+ public boolean isKerberosV5ApReqToken11() {
+ //todo
+ return true;
+ }
+
+ public boolean isGssKerberosV5ApReqToken11() {
+ //todo
+ return false;
+ }
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KeyValueTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KeyValueTokenSecurityEvent.java?rev=1301193&r1=1301192&r2=1301193&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KeyValueTokenSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/KeyValueTokenSecurityEvent.java Thu Mar 15 20:53:47 2012
@@ -24,9 +24,12 @@ package org.swssf.wss.securityEvent;
*/
public class KeyValueTokenSecurityEvent extends TokenSecurityEvent {
- //todo implement
-
public KeyValueTokenSecurityEvent() {
super(Event.KeyValueToken);
}
+
+ public boolean hasRsaKeyValue() {
+ //todo
+ return true;
+ }
}