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 2017/03/28 14:38:18 UTC
[6/6] cxf git commit: Fixing tests
Fixing tests
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/381c4b6b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/381c4b6b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/381c4b6b
Branch: refs/heads/3.0.x-fixes
Commit: 381c4b6b4d26048d0ff0fa3deed7d7f29c965cfc
Parents: 53416a5
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Mar 28 15:38:06 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Mar 28 15:38:06 2017 +0100
----------------------------------------------------------------------
.../jaxrs/security/xml/JAXRSXmlSecTest.java | 230 +++++++++----------
.../src/test/resources/keys/Bethal.jks | Bin 0 -> 2202 bytes
.../src/test/resources/keys/Morpit.jks | Bin 0 -> 2221 bytes
.../src/test/resources/keys/Truststore.jks | Bin 0 -> 4447 bytes
.../cxf/systest/jaxrs/security/xml/server.xml | 8 +-
.../systest/jaxrs/security/xml/stax-server.xml | 8 +-
6 files changed, 123 insertions(+), 123 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
index 1cc5ad2..747d12f 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
@@ -55,43 +55,43 @@ import org.junit.runners.Parameterized.Parameters;
public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
public static final String PORT = BookServerXmlSec.PORT;
public static final String STAX_PORT = StaxBookServerXmlSec.PORT;
-
+
final TestParam test;
-
+
public JAXRSXmlSecTest(TestParam type) {
this.test = type;
}
@BeforeClass
public static void startServers() throws Exception {
- assertTrue("server did not launch correctly",
+ assertTrue("server did not launch correctly",
launchServer(BookServerXmlSec.class, true));
- assertTrue("server did not launch correctly",
+ assertTrue("server did not launch correctly",
launchServer(StaxBookServerXmlSec.class, true));
}
-
+
@Parameters(name = "{0}")
public static Collection<TestParam[]> data() {
-
+
return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
{new TestParam(STAX_PORT, false)},
{new TestParam(PORT, true)},
{new TestParam(STAX_PORT, true)},
});
}
-
+
@Test
public void testPostBookWithEnvelopedSigAndProxy() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsig";
doTestSignatureProxy(address, false, null, test.streaming);
}
-
+
@Test
public void testPostBookWithEnvelopedSigAndProxy2() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsig";
doTestSignatureProxy(address, false, "", test.streaming);
}
-
+
@Test
public void testPostBookEnvelopingSigAndProxy() throws Exception {
if (test.streaming || STAX_PORT.equals(test.port)) {
@@ -101,24 +101,24 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
String address = "https://localhost:" + test.port + "/xmlsig";
doTestSignatureProxy(address, true, "file:", test.streaming);
}
-
+
@Test
public void testCertConstraints() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsigconstraints";
-
+
// Successful test with "bob"
Map<String, Object> newProperties = new HashMap<String, Object>();
- newProperties.put("ws-security.callback-handler",
+ newProperties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
newProperties.put("ws-security.signature.username", "bob");
String cryptoUrl = "org/apache/cxf/systest/jaxrs/security/bob.properties";
newProperties.put("ws-security.signature.properties", cryptoUrl);
doTestSignatureProxy(address, false, null, test.streaming, newProperties);
-
+
// Constraint validation fails with "alice"
newProperties.clear();
- newProperties.put("ws-security.callback-handler",
+ newProperties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
newProperties.put("ws-security.signature.username", "alice");
@@ -131,19 +131,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
// expected
}
}
-
+
private void doTestSignatureProxy(String address, boolean enveloping,
String cryptoUrlPrefix, boolean streaming) throws Exception {
- doTestSignatureProxy(address, enveloping, cryptoUrlPrefix,
+ doTestSignatureProxy(address, enveloping, cryptoUrlPrefix,
streaming, new HashMap<String, Object>());
}
-
+
private void doTestSignatureProxy(String address, boolean enveloping,
String cryptoUrlPrefix, boolean streaming,
Map<String, Object> properties) throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
@@ -151,10 +151,10 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
Map<String, Object> newProperties = new HashMap<String, Object>(properties);
if (newProperties.isEmpty()) {
- newProperties.put("ws-security.callback-handler",
+ newProperties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
newProperties.put("ws-security.signature.username", "alice");
-
+
String cryptoUrl = "org/apache/cxf/systest/jaxrs/security/alice.properties";
if (cryptoUrlPrefix != null) {
cryptoUrl = cryptoUrlPrefix + this.getClass().getResource("/" + cryptoUrl).toURI().getPath();
@@ -162,7 +162,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
newProperties.put("ws-security.signature.properties", cryptoUrl);
}
bean.setProperties(newProperties);
-
+
if (streaming) {
XmlSecOutInterceptor sigInterceptor = new XmlSecOutInterceptor();
sigInterceptor.setSignRequest(true);
@@ -175,24 +175,24 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
bean.getOutInterceptors().add(sigInterceptor);
}
bean.setServiceClass(BookStore.class);
-
+
BookStore store = bean.create(BookStore.class);
Book book = store.addBook(new Book("CXF", 126L));
assertEquals(126L, book.getId());
}
-
+
@Test
public void testPostBookWithEnvelopedSig() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsig/bookstore/books";
doTestSignature(address, false, false, true, test.streaming);
}
-
+
@Test
public void testPostBookWithEnvelopedSigNoKeyInfo() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsignokeyinfo/bookstore/books";
doTestSignature(address, false, false, false, test.streaming);
}
-
+
@Test
public void testPostBookWithEnvelopingSig() throws Exception {
if (test.streaming || STAX_PORT.equals(test.port)) {
@@ -202,7 +202,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
String address = "https://localhost:" + test.port + "/xmlsig/bookstore/books";
doTestSignature(address, true, false, true, test.streaming);
}
-
+
@Test
public void testPostBookWithEnvelopingSigFromResponse() throws Exception {
if (STAX_PORT.equals(test.port)) {
@@ -212,25 +212,25 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
String address = "https://localhost:" + test.port + "/xmlsig/bookstore/books";
doTestSignature(address, true, true, true, test.streaming);
}
-
- private void doTestSignature(String address,
- boolean enveloping,
+
+ private void doTestSignature(String address,
+ boolean enveloping,
boolean fromResponse,
boolean useKeyInfo,
boolean streaming) {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.signature.username", "alice");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
if (streaming) {
@@ -238,7 +238,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
sigOutInterceptor.setSignRequest(true);
sigOutInterceptor.setKeyInfoMustBeAvailable(useKeyInfo);
bean.getOutInterceptors().add(sigOutInterceptor);
-
+
XmlSecInInterceptor sigInInterceptor = new XmlSecInInterceptor();
sigInInterceptor.setRequireSignature(true);
if (!useKeyInfo) {
@@ -252,12 +252,12 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
}
sigOutInterceptor.setKeyInfoMustBeAvailable(useKeyInfo);
bean.getOutInterceptors().add(sigOutInterceptor);
-
+
XmlSigInInterceptor sigInInterceptor = new XmlSigInInterceptor();
sigInInterceptor.setKeyInfoMustBeAvailable(useKeyInfo);
bean.getInInterceptors().add(sigInInterceptor);
}
-
+
WebClient wc = bean.createWebClient();
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
Book book;
@@ -268,7 +268,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
}
assertEquals(126L, book.getId());
}
-
+
@Test
public void testSignatureNegativeServer() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsignegativeserver/bookstore/books";
@@ -281,11 +281,11 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
- Map<String, Object> properties = new HashMap<>();
- properties.put("security.callback-handler",
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- properties.put("security.signature.username", "bethal");
- properties.put("security.signature.properties",
+ properties.put("ws-security.signature.username", "bethal");
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/bethal.properties");
bean.setProperties(properties);
if (test.streaming) {
@@ -326,11 +326,11 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
- Map<String, Object> properties = new HashMap<>();
- properties.put("security.callback-handler",
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- properties.put("security.signature.username", "bethal");
- properties.put("security.signature.properties",
+ properties.put("ws-security.signature.username", "bethal");
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/bethal.properties");
bean.setProperties(properties);
if (test.streaming) {
@@ -363,20 +363,20 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
public void testPostEncryptedBook() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
doTestPostEncryptedBook(address, false, properties, test.streaming);
}
-
+
@Test
public void testPostEncryptedBookGCM() throws Exception {
//
// This test fails with the IBM JDK 7
// IBM JDK 7 appears to require a GCMParameter class to be used, which
- // only exists in JDK 7. The Sun JDK appears to be more lenient and
+ // only exists in JDK 7. The Sun JDK appears to be more lenient and
// allows us to use the existing IVParameterSpec class.
//
if ("IBM Corporation".equals(System.getProperty("java.vendor"))
@@ -384,121 +384,121 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
&& System.getProperty("java.version").startsWith("1.7")) {
return;
}
-
+
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
-
+
EncryptionProperties encryptionProperties = new EncryptionProperties();
String aes128GCM = "http://www.w3.org/2009/xmlenc11#aes128-gcm";
encryptionProperties.setEncryptionSymmetricKeyAlgo(aes128GCM);
encryptionProperties.setEncryptionKeyIdType(SecurityUtils.X509_CERT);
-
+
doTestPostEncryptedBook(address, false, properties, encryptionProperties, false, test.streaming);
}
-
+
@Test
public void testPostEncryptedBookSHA256() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
-
+
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
encryptionProperties.setEncryptionKeyIdType(SecurityUtils.X509_CERT);
encryptionProperties.setEncryptionDigestAlgo(XMLCipher.SHA256);
-
+
doTestPostEncryptedBook(
address, false, properties, encryptionProperties, false, test.streaming
);
}
-
+
@Test
public void testPostEncryptedBookIssuerSerial() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
-
+
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
encryptionProperties.setEncryptionKeyIdType(SecurityUtils.X509_ISSUER_SERIAL);
-
+
doTestPostEncryptedBook(
address, false, properties, encryptionProperties, false, test.streaming
);
}
-
+
@Test
public void testPostEncryptedSignedBook() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("ws-security.signature.username", "alice");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
doTestPostEncryptedBook(address, true, properties, test.streaming);
-
+
}
-
+
@Test
public void testPostEncryptedSignedBookInvalid() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("ws-security.signature.username", "alice");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
-
+
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(
"http://www.w3.org/2009/xmlenc11#aes128-gcm");
encryptionProperties.setEncryptionKeyIdType(SecurityUtils.X509_CERT);
-
+
try {
doTestPostEncryptedBook(address, true, properties, encryptionProperties, true, test.streaming);
} catch (BadRequestException ex) {
assertEquals(400, ex.getResponse().getStatus());
}
-
+
}
-
+
@Test
public void testPostEncryptedSignedBookUseReqSigCert() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-useReqSigCert/bookstore/books";
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("ws-security.signature.username", "alice");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
doTestPostEncryptedBook(address, true, properties, test.streaming);
}
-
+
public void doTestPostEncryptedBook(String address, boolean sign, Map<String, Object> properties,
- boolean streaming)
+ boolean streaming)
throws Exception {
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
@@ -507,7 +507,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
address, sign, properties, encryptionProperties, false, test.streaming
);
}
-
+
public void doTestPostEncryptedBook(
String address, boolean sign, Map<String, Object> properties,
EncryptionProperties encryptionProperties,
@@ -516,7 +516,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
) throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
@@ -533,7 +533,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
encInterceptor.setSignRequest(true);
}
bean.getOutInterceptors().add(encInterceptor);
-
+
XmlSecInInterceptor encInInterceptor = new XmlSecInInterceptor();
encInInterceptor.setRequireEncryption(true);
bean.setProvider(encInInterceptor);
@@ -546,13 +546,13 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
encInterceptor.setSymmetricEncAlgorithm(encryptionProperties.getEncryptionSymmetricKeyAlgo());
encInterceptor.setDigestAlgorithm(encryptionProperties.getEncryptionDigestAlgo());
bean.getOutInterceptors().add(encInterceptor);
-
+
bean.getInInterceptors().add(new XmlEncInInterceptor());
if (sign) {
bean.getInInterceptors().add(new XmlSigInInterceptor());
}
}
-
+
WebClient wc = bean.createWebClient();
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
try {
@@ -567,10 +567,10 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
} catch (ProcessingException ex) {
assertTrue(ex.getCause() instanceof BadRequestException);
}
-
+
}
-
-
+
+
@Test
public void testPostBookWithNoSig() throws Exception {
if (test.streaming) {
@@ -578,17 +578,17 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
return;
}
String address = "https://localhost:" + test.port + "/xmlsig";
-
+
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
bean.setServiceClass(BookStore.class);
-
+
BookStore store = bean.create(BookStore.class);
try {
store.addBook(new Book("CXF", 126L));
@@ -597,7 +597,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
// expected
}
}
-
+
@Test
public void testEncryptionNoSignature() throws Exception {
if (test.streaming) {
@@ -605,25 +605,25 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
return;
}
String address = "https://localhost:" + test.port + "/xmlsec-validate";
-
+
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
-
+
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
-
+
XmlEncOutInterceptor encInterceptor = new XmlEncOutInterceptor();
encInterceptor.setKeyIdentifierType(SecurityUtils.X509_CERT);
encInterceptor.setSymmetricEncAlgorithm(XMLCipher.AES_128);
@@ -632,7 +632,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
bean.getInInterceptors().add(new XmlSigInInterceptor());
bean.setServiceClass(BookStore.class);
-
+
BookStore store = bean.create(BookStore.class);
try {
store.addBook(new Book("CXF", 126L));
@@ -641,7 +641,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
// expected
}
}
-
+
@Test
public void testSignatureNoEncryption() throws Exception {
if (test.streaming) {
@@ -649,32 +649,32 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
return;
}
String address = "https://localhost:" + test.port + "/xmlsec-validate";
-
+
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
-
+
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
-
+
Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("ws-security.callback-handler",
+ properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.encryption.username", "bob");
- properties.put("ws-security.encryption.properties",
+ properties.put("ws-security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
- properties.put("ws-security.signature.properties",
+ properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
-
+
XmlSigOutInterceptor sigInterceptor = new XmlSigOutInterceptor();
bean.getOutInterceptors().add(sigInterceptor);
bean.getInInterceptors().add(new XmlEncInInterceptor());
bean.getInInterceptors().add(new XmlSigInInterceptor());
bean.setServiceClass(BookStore.class);
-
+
BookStore store = bean.create(BookStore.class);
try {
store.addBook(new Book("CXF", 126L));
@@ -683,20 +683,20 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
// expected
}
}
-
+
private static final class TestParam {
final String port;
final boolean streaming;
-
+
public TestParam(String p, boolean b) {
port = p;
streaming = b;
}
-
+
public String toString() {
return port + ":" + (streaming ? "streaming" : "dom");
}
-
+
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/resources/keys/Bethal.jks
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/keys/Bethal.jks b/systests/rs-security/src/test/resources/keys/Bethal.jks
new file mode 100644
index 0000000..8da2ad0
Binary files /dev/null and b/systests/rs-security/src/test/resources/keys/Bethal.jks differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/resources/keys/Morpit.jks
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/keys/Morpit.jks b/systests/rs-security/src/test/resources/keys/Morpit.jks
new file mode 100644
index 0000000..b179baf
Binary files /dev/null and b/systests/rs-security/src/test/resources/keys/Morpit.jks differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/resources/keys/Truststore.jks
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/keys/Truststore.jks b/systests/rs-security/src/test/resources/keys/Truststore.jks
new file mode 100644
index 0000000..0abd848
Binary files /dev/null and b/systests/rs-security/src/test/resources/keys/Truststore.jks differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/server.xml
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/server.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/server.xml
index 02c4842..0a7a60f 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/server.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/server.xml
@@ -107,8 +107,8 @@ under the License.
<ref bean="xmlSigOutHandler"/>
</jaxrs:outInterceptors>
<jaxrs:properties>
- <entry key="security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
- <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpit.properties"/>
+ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpit.properties"/>
</jaxrs:properties>
</jaxrs:server>
@@ -123,8 +123,8 @@ under the License.
<ref bean="xmlSigOutHandler"/>
</jaxrs:outInterceptors>
<jaxrs:properties>
- <entry key="security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
- <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpittrust.properties"/>
+ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpittrust.properties"/>
</jaxrs:properties>
</jaxrs:server>
http://git-wip-us.apache.org/repos/asf/cxf/blob/381c4b6b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/stax-server.xml
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/stax-server.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/stax-server.xml
index 120a329..b6fc638 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/stax-server.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/xml/stax-server.xml
@@ -127,8 +127,8 @@ under the License.
<ref bean="xmlSigOutHandler"/>
</jaxrs:outInterceptors>
<jaxrs:properties>
- <entry key="security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
- <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpit.properties"/>
+ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpit.properties"/>
</jaxrs:properties>
</jaxrs:server>
@@ -143,8 +143,8 @@ under the License.
<ref bean="xmlSigOutHandler"/>
</jaxrs:outInterceptors>
<jaxrs:properties>
- <entry key="security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
- <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpittrust.properties"/>
+ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/morpittrust.properties"/>
</jaxrs:properties>
</jaxrs:server>