Author: coheigea
Date: Wed Mar 6 17:03:06 2013
New Revision: 1453428
URL: http://svn.apache.org/r1453428
Log:
Got all tests in cxf-rt-ws-security working
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DefaultCryptoCoverageCheckerTest.java
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/saml/SamlTokenTest.java
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/CommonPasswordCallback.java
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/saml/SamlCallbackHandler.java
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Wed Mar 6 17:03:06 2013
@@ -327,9 +327,7 @@ public class WSS4JInInterceptor extends
msg.put(SECURITY_PROCESSED, Boolean.TRUE);
} catch (WSSecurityException e) {
- LOG.log(Level.WARNING, "", e);
- SoapFault fault = createSoapFault(version, e);
- throw fault;
+ throw createSoapFault(version, e);
} catch (XMLStreamException e) {
throw new SoapFault(new Message("STAX_EX", LOG), e,
version.getSender());
} catch (SOAPException e) {
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractPolicySecurityTest.java
Wed Mar 6 17:03:06 2013
@@ -345,7 +345,7 @@ public abstract class AbstractPolicySecu
URL url = ClassLoader.getSystemResource("outsecurity.properties");
cryptoProps.load(url.openStream());
Crypto crypto = CryptoFactory.getInstance(cryptoProps);
- String alias =
cryptoProps.getProperty("org.apache.wss4j.dom.crypto.merlin.keystore.alias");
+ String alias =
cryptoProps.getProperty("org.apache.ws.security.crypto.merlin.keystore.alias");
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias(alias);
issuedToken.setX509Certificate(crypto.getX509Certificates(cryptoType)[0],
crypto);
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
Wed Mar 6 17:03:06 2013
@@ -228,7 +228,7 @@ public class CryptoCoverageCheckerTest e
final String action = WSHandlerConstants.SIGNATURE + " " +
WSHandlerConstants.ENCRYPT;
inHandler.setProperty(WSHandlerConstants.ACTION, action);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
+ inHandler.setProperty(WSHandlerConstants.SIG_VER_PROP_FILE,
"insecurity.properties");
inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DefaultCryptoCoverageCheckerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DefaultCryptoCoverageCheckerTest.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DefaultCryptoCoverageCheckerTest.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DefaultCryptoCoverageCheckerTest.java
Wed Mar 6 17:03:06 2013
@@ -124,7 +124,7 @@ public class DefaultCryptoCoverageChecke
final String action = WSHandlerConstants.SIGNATURE + " " +
WSHandlerConstants.ENCRYPT;
inHandler.setProperty(WSHandlerConstants.ACTION, action);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
+ inHandler.setProperty(WSHandlerConstants.SIG_VER_PROP_FILE,
"insecurity.properties");
inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
Wed Mar 6 17:03:06 2013
@@ -170,8 +170,8 @@ public class WSS4JFaultCodeTest extends
inHandler.handleMessage(inmsg);
fail("Expected failure on an invalid Timestamp");
} catch (SoapFault fault) {
- assertTrue(fault.getReason().startsWith(
- "The message has expired"));
+ assertTrue(fault.getReason().contains(
+ " The security semantics of the message have expired"));
QName faultCode = new QName(WSConstants.WSSE_NS, "MessageExpired");
assertTrue(fault.getFaultCode().equals(faultCode));
}
Modified:
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/saml/SamlTokenTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/saml/SamlTokenTest.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/saml/SamlTokenTest.java
(original)
+++
cxf/branches/wss4j2.0-port/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/saml/SamlTokenTest.java
Wed Mar 6 17:03:06 2013
@@ -154,101 +154,6 @@ public class SamlTokenTest extends Abstr
assert !receivedAssertion.isSigned();
}
- /**
- * This test creates a sender-vouches SAML1 Assertion, where the Assertion
and SOAP body are
- * signed, and sends it in the security header to the provider.
- */
- @Test
- public void testSaml1TokenSignedSenderVouches() throws Exception {
- Map<String, Object> outProperties = new HashMap<String, Object>();
- outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SAML_TOKEN_SIGNED);
- outProperties.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
- outProperties.put(WSHandlerConstants.USER, "myalias");
- outProperties.put("password", "myAliasPassword");
- outProperties.put(
- WSHandlerConstants.SAML_CALLBACK_REF, new SAML1CallbackHandler()
- );
-
- Map<String, Object> inProperties = new HashMap<String, Object>();
- inProperties.put(
- WSHandlerConstants.ACTION,
- WSHandlerConstants.SAML_TOKEN_UNSIGNED + " " +
WSHandlerConstants.SIGNATURE
- );
- inProperties.put(WSHandlerConstants.SIG_VER_PROP_FILE,
"insecurity.properties");
- final Map<QName, Object> customMap = new HashMap<QName, Object>();
- CustomSamlValidator validator = new CustomSamlValidator();
- customMap.put(WSSecurityEngine.SAML_TOKEN, validator);
- customMap.put(WSSecurityEngine.SAML2_TOKEN, validator);
- inProperties.put(WSS4JInInterceptor.VALIDATOR_MAP, customMap);
-
- List<String> xpaths = new ArrayList<String>();
- xpaths.add("//wsse:Security");
- xpaths.add("//wsse:Security/saml1:Assertion");
-
- Message message = makeInvocation(outProperties, xpaths, inProperties);
- final List<WSHandlerResult> handlerResults =
-
CastUtils.cast((List<?>)message.get(WSHandlerConstants.RECV_RESULTS));
-
- WSSecurityEngineResult actionResult =
-
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.ST_UNSIGNED);
- SamlAssertionWrapper receivedAssertion =
- (SamlAssertionWrapper)
actionResult.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
- assertTrue(receivedAssertion != null && receivedAssertion.getSaml1()
!= null);
- assert !receivedAssertion.isSigned();
-
- actionResult =
-
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.SIGN);
- assertTrue(actionResult != null);
- }
-
- /**
- * This test creates a sender-vouches SAML2 Assertion, where the Assertion
and SOAP body are
- * signed, and sends it in the security header to the provider.
- */
- @Test
- public void testSaml2TokenSignedSenderVouches() throws Exception {
- Map<String, Object> outProperties = new HashMap<String, Object>();
- outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SAML_TOKEN_SIGNED);
- outProperties.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
- outProperties.put(WSHandlerConstants.USER, "myalias");
- outProperties.put("password", "myAliasPassword");
- outProperties.put(
- WSHandlerConstants.SAML_CALLBACK_REF, new SAML2CallbackHandler()
- );
-
- Map<String, Object> inProperties = new HashMap<String, Object>();
- inProperties.put(
- WSHandlerConstants.ACTION,
- WSHandlerConstants.SAML_TOKEN_UNSIGNED + " " +
WSHandlerConstants.SIGNATURE
- );
- inProperties.put(WSHandlerConstants.SIG_VER_PROP_FILE,
"insecurity.properties");
- final Map<QName, Object> customMap = new HashMap<QName, Object>();
- CustomSamlValidator validator = new CustomSamlValidator();
- validator.setRequireSAML1Assertion(false);
- customMap.put(WSSecurityEngine.SAML_TOKEN, validator);
- customMap.put(WSSecurityEngine.SAML2_TOKEN, validator);
- inProperties.put(WSS4JInInterceptor.VALIDATOR_MAP, customMap);
-
- List<String> xpaths = new ArrayList<String>();
- xpaths.add("//wsse:Security");
- xpaths.add("//wsse:Security/saml2:Assertion");
-
- Message message = makeInvocation(outProperties, xpaths, inProperties);
- final List<WSHandlerResult> handlerResults =
-
CastUtils.cast((List<?>)message.get(WSHandlerConstants.RECV_RESULTS));
-
- WSSecurityEngineResult actionResult =
-
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.ST_UNSIGNED);
- SamlAssertionWrapper receivedAssertion =
- (SamlAssertionWrapper)
actionResult.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
- assertTrue(receivedAssertion != null && receivedAssertion.getSaml2()
!= null);
- assert !receivedAssertion.isSigned();
-
- actionResult =
-
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.SIGN);
- assertTrue(actionResult != null);
- }
-
/**
* This test creates a holder-of-key SAML1 Assertion, and sends it in the
security header
Modified:
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/CommonPasswordCallback.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/CommonPasswordCallback.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/CommonPasswordCallback.java
(original)
+++
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/CommonPasswordCallback.java
Wed Mar 6 17:03:06 2013
@@ -26,7 +26,7 @@ import javax.security.auth.callback.Call
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.ws.security.WSPasswordCallback;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
/**
*/
Modified:
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/saml/SamlCallbackHandler.java
URL:
http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/saml/SamlCallbackHandler.java?rev=1453428&r1=1453427&r2=1453428&view=diff
==============================================================================
---
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/saml/SamlCallbackHandler.java
(original)
+++
cxf/branches/wss4j2.0-port/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/saml/SamlCallbackHandler.java
Wed Mar 6 17:03:06 2013
@@ -27,17 +27,17 @@ import javax.security.auth.callback.Call
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.ws.security.components.crypto.Crypto;
-import org.apache.ws.security.components.crypto.CryptoFactory;
-import org.apache.ws.security.components.crypto.CryptoType;
-import org.apache.ws.security.saml.ext.SAMLCallback;
-import org.apache.ws.security.saml.ext.bean.AttributeBean;
-import org.apache.ws.security.saml.ext.bean.AttributeStatementBean;
-import org.apache.ws.security.saml.ext.bean.KeyInfoBean;
-import org.apache.ws.security.saml.ext.bean.KeyInfoBean.CERT_IDENTIFIER;
-import org.apache.ws.security.saml.ext.bean.SubjectBean;
-import org.apache.ws.security.saml.ext.builder.SAML1Constants;
-import org.apache.ws.security.saml.ext.builder.SAML2Constants;
+import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.crypto.CryptoFactory;
+import org.apache.wss4j.common.crypto.CryptoType;
+import org.apache.wss4j.common.saml.SAMLCallback;
+import org.apache.wss4j.common.saml.bean.AttributeBean;
+import org.apache.wss4j.common.saml.bean.AttributeStatementBean;
+import org.apache.wss4j.common.saml.bean.KeyInfoBean;
+import org.apache.wss4j.common.saml.bean.KeyInfoBean.CERT_IDENTIFIER;
+import org.apache.wss4j.common.saml.bean.SubjectBean;
+import org.apache.wss4j.common.saml.builder.SAML1Constants;
+import org.apache.wss4j.common.saml.builder.SAML2Constants;
import org.opensaml.common.SAMLVersion;
/**