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 16:10:15 UTC
[3/5] cxf git commit: Switching to use security constants in the
tests instead of strings
Switching to use security constants in the tests instead of strings
# Conflicts:
# rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
# services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java
# services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
# services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
# systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
# systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java
# systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
# systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
# systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
# systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java
# systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCUnitTest.java
# systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/DoubleItPropertiesImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/30119990
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/30119990
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/30119990
Branch: refs/heads/3.1.x-fixes
Commit: 30119990866f5da50d5261653a1843c618cd6459
Parents: 0b094e8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Mar 28 16:27:09 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Mar 28 16:30:35 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/cxf/ws/rm/RMManager.java | 4 +-
.../systest/sts/custom/CustomParameterTest.java | 16 +--
.../custom_onbehalfof/CustomOnBehalfOfTest.java | 5 +-
.../cxf/systest/sts/renew/SAMLRenewTest.java | 2 +-
.../SecurityContextTokenCancelTest.java | 2 +-
.../sts/sendervouches/DoubleItPortTypeImpl.java | 3 +-
.../sts/symmetric/SymmetricBindingTest.java | 10 +-
.../cxf/systest/sts/template/TemplateTest.java | 8 +-
.../sts/transport/TransportBindingTest.java | 8 +-
.../UsernameActAsCachingTest.java | 34 ++---
.../sts/username_actas/UsernameActAsTest.java | 7 +-
.../UsernameOnBehalfOfCachingTest.java | 36 ++---
.../UsernameOnBehalfOfTest.java | 9 +-
.../security/oauth2/grants/JAXRSOAuth2Test.java | 13 +-
.../saml/JAXRSSamlAuthorizationTest.java | 5 +-
.../jaxrs/security/xml/JAXRSXmlSecTest.java | 140 +++++++++++++++++--
.../ws/rm/sec/WSRMWithWSSecurityPolicyTest.java | 39 +++++-
.../apache/cxf/systest/ws/fault/FaultTest.java | 31 ++--
.../ws/policy/handler/HelloServiceImpl.java | 49 +++++++
.../cxf/systest/ws/saml/SamlTokenTest.java | 62 ++++----
.../saml/subjectconf/SamlSubjectConfTest.java | 19 +--
.../cxf/systest/ws/wssc/WSSCUnitTest.java | 25 +++-
.../systest/ws/x509/DoubleItPropertiesImpl.java | 8 ++
23 files changed, 381 insertions(+), 154 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
index 6a0839e..a29a6a7 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
@@ -475,8 +475,8 @@ public class RMManager {
Map<String, Object> context = new HashMap<String, Object>(16);
for (String key : message.getContextualPropertyKeys()) {
//copy other properties?
- if (key.startsWith("ws-security")) {
- context.put(key, message.getContextualProperty(key));
+ if (key.startsWith("ws-security") || key.startsWith("security.")) {
+ context.put(key, message.getContextualProperty(key));
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java
index 9100f56..1048a84 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java
@@ -98,8 +98,8 @@ public class CustomParameterTest extends AbstractBusClientServerTestBase {
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port");
Map<String, Object> properties = new HashMap<>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler", "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("security.sts.token.username", "myclientkey");
properties.put("security.sts.token.properties", "clientKeystore.properties");
properties.put("security.sts.token.usecert", "true");
@@ -143,8 +143,8 @@ public class CustomParameterTest extends AbstractBusClientServerTestBase {
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port");
Map<String, Object> properties = new HashMap<>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler", "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("security.sts.token.username", "myclientkey");
properties.put("security.sts.token.properties", "clientKeystore.properties");
properties.put("security.sts.token.usecert", "true");
@@ -193,8 +193,8 @@ public class CustomParameterTest extends AbstractBusClientServerTestBase {
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");
Map<String, Object> properties = new HashMap<>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler", "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("security.sts.token.username", "myclientkey");
properties.put("security.sts.token.properties", "clientKeystore.properties");
properties.put("security.sts.token.usecert", "true");
@@ -238,8 +238,8 @@ public class CustomParameterTest extends AbstractBusClientServerTestBase {
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");
Map<String, Object> properties = new HashMap<>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler", "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("security.sts.token.username", "myclientkey");
properties.put("security.sts.token.properties", "clientKeystore.properties");
properties.put("security.sts.token.usecert", "true");
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java
index fea7af8..7844e83 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom_onbehalfof/CustomOnBehalfOfTest.java
@@ -26,6 +26,7 @@ import javax.xml.ws.Service;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.sts.common.SecurityTestUtil;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -35,7 +36,7 @@ import org.junit.BeforeClass;
/**
* In this test case, a CXF client requests a Security Token from an STS, passing a username that
* it has obtained from an unknown client as an "OnBehalfOf" element. This username is obtained
- * by parsing the "security.username" property. The client then invokes on the service
+ * by parsing the SecurityConstants.USERNAME property. The client then invokes on the service
* provider using the returned (custom BinarySecurityToken) token from the STS. The service
* provider dispatches the received BinarySecurityToken to the STS for validation, and receives
* a transformed SAML Token in response.
@@ -89,7 +90,7 @@ public class CustomOnBehalfOfTest extends AbstractBusClientServerTestBase {
// Transport port
((BindingProvider)transportPort).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(transportPort, 25);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
index 3c7a8a7..004c25c 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/renew/SAMLRenewTest.java
@@ -111,7 +111,7 @@ public class SAMLRenewTest extends AbstractBusClientServerTestBase {
updateAddressPort(saml2IntermediaryPort, PORT);
((BindingProvider)saml2IntermediaryPort).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
// Make initial successful invocation(s)
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java
index 7e73b53..7098d63 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenCancelTest.java
@@ -97,7 +97,7 @@ public class SecurityContextTokenCancelTest extends AbstractBusClientServerTestB
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(SecurityConstants.USERNAME, "alice");
properties.put(
- "security.callback-handler",
+ SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.sts.common.CommonCallbackHandler"
);
properties.put("ws-security.sts.token.properties", "serviceKeystore.properties");
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/DoubleItPortTypeImpl.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/DoubleItPortTypeImpl.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/DoubleItPortTypeImpl.java
index 6e37b53..77f816f 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/DoubleItPortTypeImpl.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/DoubleItPortTypeImpl.java
@@ -28,6 +28,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebServiceContext;
import org.apache.cxf.feature.Features;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.example.contract.doubleit.DoubleItPortType;
@@ -63,7 +64,7 @@ public class DoubleItPortTypeImpl extends AbstractBusClientServerTestBase implem
//
Saml2CallbackHandler callbackHandler = new Saml2CallbackHandler(wsc.getUserPrincipal());
((BindingProvider)transportSAML2SupportingPort).getRequestContext().put(
- "security.saml-callback-handler", callbackHandler
+ SecurityConstants.SAML_CALLBACK_HANDLER, callbackHandler
);
return transportSAML2SupportingPort.doubleIt(numberToDouble);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
index 05681fc..7b06206 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
@@ -352,12 +352,12 @@ public class SymmetricBindingTest extends AbstractBusClientServerTestBase {
stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService");
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port");
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler",
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.sts.common.CommonCallbackHandler");
- properties.put("security.encryption.username", "mystskey");
- properties.put("security.encryption.properties", "clientKeystore.properties");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES, "clientKeystore.properties");
properties.put("ws-security.is-bsp-compliant", "false");
stsClient.setProperties(properties);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
index 39a59f3..f8c6d8d 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
@@ -346,10 +346,10 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
STSClient stsClient = new STSClient(bus);
stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService");
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler",
+
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("ws-security.sts.token.username", "myclientkey");
properties.put("ws-security.sts.token.properties", "clientKeystore.properties");
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
index 4ea89ce..7e14507 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
@@ -435,10 +435,10 @@ public class TransportBindingTest extends AbstractBusClientServerTestBase {
STSClient stsClient = new STSClient(bus);
stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService");
stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("security.username", "alice");
- properties.put("security.callback-handler",
+
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.USERNAME, "alice");
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.sts.common.CommonCallbackHandler");
properties.put("ws-security.sts.token.username", "myclientkey");
properties.put("ws-security.sts.token.properties", "clientKeystore.properties");
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
index c8d2f1c..9cef3f7 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
@@ -44,7 +44,7 @@ import org.junit.BeforeClass;
/**
* In this test case, a CXF client requests a Security Token from an STS, passing a username that
* it has obtained from an unknown client as an "ActAs" element. This username is obtained
- * by parsing the "security.username" property. The client then invokes on the service
+ * by parsing the SecurityConstants.USERNAME property. The client then invokes on the service
* provider using the returned token from the STS.
*/
public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
@@ -109,7 +109,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
@@ -145,7 +145,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
// Make another invocation - this should succeed as the token is cached
- p.getRequestContext().put("security.username", "alice");
+ p.getRequestContext().put(SecurityConstants.USERNAME, "alice");
doubleIt(port2, 40);
// Reset the cache - this invocation should fail
@@ -192,17 +192,17 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
doubleIt(port, 30);
((BindingProvider)port).getRequestContext().put(
- "security.username", "eve"
+ SecurityConstants.USERNAME, "eve"
);
try {
doubleIt(port, 30);
@@ -217,17 +217,17 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
doubleIt(port, 30);
((BindingProvider)port).getRequestContext().put(
- "security.username", "eve2"
+ SecurityConstants.USERNAME, "eve2"
);
try {
doubleIt(port, 30);
@@ -239,7 +239,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Reset the cache - this invocation should fail
p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
try {
doubleIt(port, 30);
@@ -282,7 +282,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
BindingProvider p = (BindingProvider)port;
p.getRequestContext().put(
@@ -293,7 +293,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -306,7 +306,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -316,7 +316,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -326,7 +326,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Change appliesTo - should fail
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -373,7 +373,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
// Disable appliesTo
BindingProvider p = (BindingProvider)port;
@@ -392,7 +392,7 @@ public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
// Bob should fail
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
try {
doubleIt(port, 30);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
index 705b63c..7857b4f 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
@@ -28,6 +28,7 @@ import javax.xml.ws.Service;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.sts.common.SecurityTestUtil;
import org.apache.cxf.systest.sts.common.TestParam;
import org.apache.cxf.systest.sts.common.TokenTestUtils;
@@ -43,7 +44,7 @@ import org.junit.runners.Parameterized.Parameters;
/**
* In this test case, a CXF client requests a Security Token from an STS, passing a username that
* it has obtained from an unknown client as an "ActAs" element. This username is obtained
- * by parsing the "security.username" property. The client then invokes on the service
+ * by parsing the SecurityConstants.USERNAME property. The client then invokes on the service
* provider using the returned token from the STS.
*/
@RunWith(value = org.junit.runners.Parameterized.class)
@@ -126,7 +127,7 @@ public class UsernameActAsTest extends AbstractBusClientServerTestBase {
// Transport port
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
@@ -144,7 +145,7 @@ public class UsernameActAsTest extends AbstractBusClientServerTestBase {
}
((BindingProvider)port2).getRequestContext().put(
- "security.username", "eve"
+ SecurityConstants.USERNAME, "eve"
);
// This time we expect a failure as the server validator doesn't accept "eve".
try {
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
index 1f6dda2..4ae1568 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
@@ -43,8 +43,8 @@ import org.junit.BeforeClass;
/**
* In this test case, a CXF client requests a Security Token from an STS, passing a username that
* it has obtained from an unknown client as an "OnBehalfOf" element. This username is obtained
- * by parsing the "security.username" property. The client then invokes on the service
- * provider using the returned token from the STS.
+ * by parsing the SecurityConstants.USERNAME property. The client then invokes on the service
+ * provider using the returned token from the STS.
*/
public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBase {
@@ -108,7 +108,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
@@ -145,7 +145,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
// Make another invocation - this should succeed as the token is cached
- p.getRequestContext().put("security.username", "alice");
+ p.getRequestContext().put(SecurityConstants.USERNAME, "alice");
doubleIt(port2, 40);
// Reset the cache - this invocation should fail
@@ -192,17 +192,17 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
doubleIt(port, 30);
((BindingProvider)port).getRequestContext().put(
- "security.username", "eve"
+ SecurityConstants.USERNAME, "eve"
);
try {
doubleIt(port, 30);
@@ -217,17 +217,17 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
doubleIt(port, 30);
((BindingProvider)port).getRequestContext().put(
- "security.username", "eve2"
+ SecurityConstants.USERNAME, "eve2"
);
try {
doubleIt(port, 30);
@@ -239,7 +239,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Reset the cache - this invocation should fail
p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
try {
doubleIt(port, 30);
@@ -282,7 +282,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
BindingProvider p = (BindingProvider)port;
p.getRequestContext().put(
@@ -293,7 +293,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -306,7 +306,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -316,7 +316,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -326,7 +326,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Change appliesTo - should fail
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
@@ -373,7 +373,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
// Disable appliesTo
BindingProvider p = (BindingProvider)port;
@@ -392,7 +392,7 @@ public class UsernameOnBehalfOfCachingTest extends AbstractBusClientServerTestBa
// Bob should fail
((BindingProvider)port).getRequestContext().put(
- "security.username", "bob"
+ SecurityConstants.USERNAME, "bob"
);
try {
doubleIt(port, 30);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
index 04b11b0..b72a830 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
@@ -28,6 +28,7 @@ import javax.xml.ws.Service;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.sts.common.SecurityTestUtil;
import org.apache.cxf.systest.sts.common.TestParam;
import org.apache.cxf.systest.sts.common.TokenTestUtils;
@@ -42,8 +43,8 @@ import org.junit.runners.Parameterized.Parameters;
/**
* In this test case, a CXF client requests a Security Token from an STS, passing a username that
* it has obtained from an unknown client as an "OnBehalfOf" element. This username is obtained
- * by parsing the "security.username" property. The client then invokes on the service
- * provider using the returned token from the STS.
+ * by parsing the SecurityConstants.USERNAME property. The client then invokes on the service
+ * provider using the returned token from the STS.
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class UsernameOnBehalfOfTest extends AbstractBusClientServerTestBase {
@@ -124,7 +125,7 @@ public class UsernameOnBehalfOfTest extends AbstractBusClientServerTestBase {
// Transport port
((BindingProvider)port).getRequestContext().put(
- "security.username", "alice"
+ SecurityConstants.USERNAME, "alice"
);
doubleIt(port, 25);
@@ -142,7 +143,7 @@ public class UsernameOnBehalfOfTest extends AbstractBusClientServerTestBase {
}
((BindingProvider)port2).getRequestContext().put(
- "security.username", "eve"
+ SecurityConstants.USERNAME, "eve"
);
// This time we expect a failure as the server validator doesn't accept "eve".
try {
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
index 7adb545..d05d3bb 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
@@ -50,6 +50,7 @@ import org.apache.cxf.rs.security.oauth2.saml.Constants;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
import org.apache.cxf.rs.security.saml.SAMLUtils;
import org.apache.cxf.rs.security.saml.SAMLUtils.SelfSignInfo;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.SamlCallbackHandler;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -481,18 +482,18 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("security.callback-handler",
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler(true);
samlCallbackHandler.setIssuer("alice");
String audienceURI = "https://localhost:" + PORT + "/oauth2-auth/token";
samlCallbackHandler.setAudience(audienceURI);
- properties.put("security.saml-callback-handler", samlCallbackHandler);
-
- properties.put("security.signature.username", "alice");
- properties.put("security.signature.properties", CRYPTO_RESOURCE_PROPERTIES);
+ properties.put(SecurityConstants.SAML_CALLBACK_HANDLER, samlCallbackHandler);
+
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES, CRYPTO_RESOURCE_PROPERTIES);
bean.setProperties(properties);
bean.getOutInterceptors().add(new Saml2BearerAuthOutInterceptor());
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java
index 0ce5f11..91c5d06 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlAuthorizationTest.java
@@ -32,6 +32,7 @@ import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.rs.security.saml.SamlEnvelopedOutInterceptor;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.jaxrs.security.Book;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -153,8 +154,8 @@ public class JAXRSSamlAuthorizationTest extends AbstractBusClientServerTestBase
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("security.saml-callback-handler",
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.SAML_CALLBACK_HANDLER,
"org.apache.cxf.systest.jaxrs.security.saml.SamlCallbackHandler");
if (extraProperties != null) {
properties.putAll(extraProperties);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/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 3d55f31..83584e5 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
@@ -41,6 +41,7 @@ import org.apache.cxf.rs.security.xml.XmlSecInInterceptor;
import org.apache.cxf.rs.security.xml.XmlSecOutInterceptor;
import org.apache.cxf.rs.security.xml.XmlSigInInterceptor;
import org.apache.cxf.rs.security.xml.XmlSigOutInterceptor;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.jaxrs.security.Book;
import org.apache.cxf.systest.jaxrs.security.BookStore;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -98,12 +99,12 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
bean.setBus(springBus);
Map<String, Object> newProperties = new HashMap<>();
- newProperties.put("ws-security.callback-handler",
+ newProperties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- newProperties.put("ws-security.signature.username", "alice");
+ newProperties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
String cryptoUrl = "org/apache/cxf/systest/jaxrs/security/alice.properties";
- newProperties.put("ws-security.signature.properties", cryptoUrl);
+ newProperties.put(SecurityConstants.SIGNATURE_PROPERTIES, cryptoUrl);
bean.setProperties(newProperties);
if (test.streaming) {
@@ -142,23 +143,32 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
String address = "https://localhost:" + test.port + "/xmlsigconstraints";
// Successful test with "bob"
+<<<<<<< HEAD
Map<String, Object> newProperties = new HashMap<String, Object>();
newProperties.put("security.callback-handler",
+=======
+ Map<String, Object> newProperties = new HashMap<>();
+ newProperties.put(SecurityConstants.CALLBACK_HANDLER,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- newProperties.put("security.signature.username", "bob");
+ newProperties.put(SecurityConstants.SIGNATURE_USERNAME, "bob");
String cryptoUrl = "org/apache/cxf/systest/jaxrs/security/bob.properties";
- newProperties.put("security.signature.properties", cryptoUrl);
+ newProperties.put(SecurityConstants.SIGNATURE_PROPERTIES, cryptoUrl);
doTestSignatureProxy(address, false, null, test.streaming, newProperties);
// Constraint validation fails with "alice"
newProperties.clear();
+<<<<<<< HEAD
newProperties.put("security.callback-handler",
+=======
+ newProperties.put(SecurityConstants.CALLBACK_HANDLER,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- newProperties.put("security.signature.username", "alice");
+ newProperties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
cryptoUrl = "org/apache/cxf/systest/jaxrs/security/alice.properties";
- newProperties.put("security.signature.properties", cryptoUrl);
+ newProperties.put(SecurityConstants.SIGNATURE_PROPERTIES, cryptoUrl);
try {
doTestSignatureProxy(address, false, null, test.streaming, newProperties);
fail("Failure expected on a failing cert constraint");
@@ -186,15 +196,22 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
Map<String, Object> newProperties = new HashMap<String, Object>(properties);
if (newProperties.isEmpty()) {
+<<<<<<< HEAD
newProperties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
newProperties.put("security.signature.username", "alice");
+=======
+ newProperties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ newProperties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
String cryptoUrl = "org/apache/cxf/systest/jaxrs/security/alice.properties";
if (cryptoUrlPrefix != null) {
cryptoUrl = cryptoUrlPrefix + this.getClass().getResource("/" + cryptoUrl).toURI().getPath();
}
- newProperties.put("security.signature.properties", cryptoUrl);
+ newProperties.put(SecurityConstants.SIGNATURE_PROPERTIES, cryptoUrl);
}
bean.setProperties(newProperties);
@@ -261,11 +278,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("security.signature.username", "alice");
properties.put("security.signature.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
if (streaming) {
@@ -317,10 +342,10 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
bean.setBus(springBus);
Map<String, Object> properties = new HashMap<>();
- properties.put("security.callback-handler",
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- properties.put("security.signature.username", "bethal");
- properties.put("security.signature.properties",
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "bethal");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
"org/apache/cxf/systest/jaxrs/security/bethal.properties");
bean.setProperties(properties);
if (test.streaming) {
@@ -362,10 +387,10 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
bean.setBus(springBus);
Map<String, Object> properties = new HashMap<>();
- properties.put("security.callback-handler",
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
- properties.put("security.signature.username", "bethal");
- properties.put("security.signature.properties",
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "bethal");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
"org/apache/cxf/systest/jaxrs/security/bethal.properties");
bean.setProperties(properties);
if (test.streaming) {
@@ -397,11 +422,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedBook() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("security.encryption.username", "bob");
properties.put("security.encryption.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/bob.properties");
doTestPostEncryptedBook(address, false, properties, test.streaming);
}
@@ -421,11 +454,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
}
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("security.encryption.username", "bob");
properties.put("security.encryption.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
@@ -439,11 +480,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedBookSHA256() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("security.encryption.username", "bob");
properties.put("security.encryption.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
@@ -459,11 +508,19 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedBookIssuerSerial() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("security.encryption.username", "bob");
properties.put("security.encryption.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
@@ -478,6 +535,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedSignedBook() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
@@ -486,6 +544,16 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("security.signature.username", "alice");
properties.put("security.signature.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "org/apache/cxf/systest/jaxrs/security/bob.properties");
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
doTestPostEncryptedBook(address, true, properties, test.streaming);
@@ -494,6 +562,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedSignedBookInvalid() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
@@ -502,6 +571,16 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("security.signature.username", "alice");
properties.put("security.signature.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "org/apache/cxf/systest/jaxrs/security/bob.properties");
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
@@ -520,6 +599,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
@Test
public void testPostEncryptedSignedBookUseReqSigCert() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-useReqSigCert/bookstore/books";
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
@@ -528,6 +608,16 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("security.signature.username", "alice");
properties.put("security.signature.properties",
+=======
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "org/apache/cxf/systest/jaxrs/security/bob.properties");
+ properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
doTestPostEncryptedBook(address, true, properties, test.streaming);
}
@@ -648,6 +738,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
@@ -656,6 +747,16 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
properties.put("security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("security.signature.properties",
+=======
+
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "org/apache/cxf/systest/jaxrs/security/bob.properties");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
@@ -692,6 +793,7 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
URL busFile = JAXRSXmlSecTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
+<<<<<<< HEAD
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("security.callback-handler",
@@ -700,6 +802,16 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase {
properties.put("security.encryption.properties",
"org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put("security.signature.properties",
+=======
+
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
+ properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ properties.put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "org/apache/cxf/systest/jaxrs/security/bob.properties");
+ properties.put(SecurityConstants.SIGNATURE_PROPERTIES,
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
"org/apache/cxf/systest/jaxrs/security/alice.properties");
bean.setProperties(properties);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
index f3d2c19..c70f57d 100644
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
@@ -33,6 +33,7 @@ import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.greeter_control.Greeter;
import org.apache.cxf.greeter_control.types.GreetMe;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -45,7 +46,7 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
- * Tests the correct interaction of ws-rm calls with ws-security when policy validator verifies the calls.
+ * Tests the correct interaction of ws-rm calls with security.when policy validator verifies the calls.
*/
public class WSRMWithWSSecurityPolicyTest extends AbstractBusClientServerTestBase {
public static final String PORT = allocatePort(Server.class);
@@ -95,6 +96,7 @@ public class WSRMWithWSSecurityPolicyTest extends AbstractBusClientServerTestBas
@Test
public void testContextProperty() throws Exception {
+<<<<<<< HEAD
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml");
Bus bus = (Bus)context.getBean("bus");
@@ -126,6 +128,41 @@ public class WSRMWithWSSecurityPolicyTest extends AbstractBusClientServerTestBas
Thread.sleep(5000);
empty = manager.getRetransmissionQueue().isEmpty();
assertTrue("RetransmissionQueue not empty", empty);
+=======
+ try (ClassPathXmlApplicationContext context =
+ new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml")) {
+ Bus bus = (Bus)context.getBean("bus");
+ BusFactory.setDefaultBus(bus);
+ BusFactory.setThreadDefaultBus(bus);
+ Greeter greeter = (Greeter)context.getBean("GreeterCombinedClientNoProperty");
+ Client client = ClientProxy.getClient(greeter);
+ QName operationQName = new QName("http://cxf.apache.org/greeter_control", "greetMe");
+ BindingOperationInfo boi = client.getEndpoint().getBinding().getBindingInfo().getOperation(operationQName);
+ Map<String, Object> invocationContext = new HashMap<>();
+ Map<String, Object> requestContext = new HashMap<>();
+ Map<String, Object> responseContext = new HashMap<>();
+ invocationContext.put(Client.REQUEST_CONTEXT, requestContext);
+ invocationContext.put(Client.RESPONSE_CONTEXT, responseContext);
+
+ requestContext.put(SecurityConstants.USERNAME, "Alice");
+ requestContext.put(SecurityConstants.CALLBACK_HANDLER,
+ "org.apache.cxf.systest.ws.rm.sec.UTPasswordCallback");
+ requestContext.put(SecurityConstants.ENCRYPT_PROPERTIES, "bob.properties");
+ requestContext.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ requestContext.put(SecurityConstants.SIGNATURE_PROPERTIES, "alice.properties");
+ requestContext.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+ RMManager manager = bus.getExtension(RMManager.class);
+ boolean empty = manager.getRetransmissionQueue().isEmpty();
+ assertTrue("RetransmissionQueue is not empty", empty);
+ GreetMe param = new GreetMe();
+ param.setRequestType("testContextProperty");
+ Object[] answer = client.invoke(boi, new Object[]{param}, invocationContext);
+ Assert.assertEquals("TESTCONTEXTPROPERTY", answer[0].toString());
+ Thread.sleep(5000);
+ empty = manager.getRetransmissionQueue().isEmpty();
+ assertTrue("RetransmissionQueue not empty", empty);
+ }
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index 471f07c..614b82c 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -37,6 +37,7 @@ import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.DispatchImpl;
+import org.apache.cxf.rt.security.SecurityConstants;
import org.apache.cxf.systest.ws.common.SecurityTestUtil;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.wss4j.dom.WSConstants;
@@ -86,11 +87,11 @@ public class FaultTest extends AbstractBusClientServerTestBase {
updateAddressPort(utPort, PORT);
// Make a successful invocation
- ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
utPort.doubleIt(25);
// Now make an invocation using another username
- ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
((BindingProvider)utPort).getRequestContext().put("security.password", "password");
try {
utPort.doubleIt(25);
@@ -119,11 +120,11 @@ public class FaultTest extends AbstractBusClientServerTestBase {
updateAddressPort(utPort, PORT);
// Make a successful invocation
- ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
utPort.doubleIt(25);
// Now make an invocation using another username
- ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
((BindingProvider)utPort).getRequestContext().put("security.password", "password");
try {
utPort.doubleIt(25);
@@ -152,11 +153,11 @@ public class FaultTest extends AbstractBusClientServerTestBase {
updateAddressPort(utPort, PORT);
// Make a successful invocation
- ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
utPort.doubleIt(25);
// Now make an invocation using another username
- ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
((BindingProvider)utPort).getRequestContext().put("security.password", "password");
try {
utPort.doubleIt(25);
@@ -195,24 +196,24 @@ public class FaultTest extends AbstractBusClientServerTestBase {
// Add WS-Security configuration
Client client = ((DispatchImpl<DOMSource>) dispatch).getClient();
client.getRequestContext().put(
- "security.callback-handler",
+ SecurityConstants.CALLBACK_HANDLER,
"org.apache.cxf.systest.ws.common.KeystorePasswordCallback"
);
client.getRequestContext().put(
- "security.encryption.properties",
+ SecurityConstants.ENCRYPT_PROPERTIES,
"bob.properties"
);
- client.getRequestContext().put("security.encryption.username", "bob");
+ client.getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
updateAddressPort(dispatch, PORT);
// Make a successful request
- client.getRequestContext().put("security.username", "alice");
+ client.getRequestContext().put(SecurityConstants.USERNAME, "alice");
DOMSource response = dispatch.invoke(request);
assertNotNull(response);
// Now make an invocation using another username
- client.getRequestContext().put("security.username", "bob");
+ client.getRequestContext().put(SecurityConstants.USERNAME, "bob");
client.getRequestContext().put("security.password", "password");
try {
dispatch.invoke(request);
@@ -242,11 +243,11 @@ public class FaultTest extends AbstractBusClientServerTestBase {
updateAddressPort(utPort, PORT);
// Make a successful invocation
- ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
utPort.doubleIt(25);
// Now make an invocation using another username
- ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
((BindingProvider)utPort).getRequestContext().put("security.password", "password");
try {
utPort.doubleIt(25);
@@ -278,11 +279,11 @@ public class FaultTest extends AbstractBusClientServerTestBase {
updateAddressPort(utPort, PORT);
// Make a successful invocation
- ((BindingProvider)utPort).getRequestContext().put("security.username", "alice");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
utPort.doubleIt(25);
// Now make an invocation using another username
- ((BindingProvider)utPort).getRequestContext().put("security.username", "bob");
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
((BindingProvider)utPort).getRequestContext().put("security.password", "password");
try {
utPort.doubleIt(25);
http://git-wip-us.apache.org/repos/asf/cxf/blob/30119990/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java
index 9094ddb..f597037 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/handler/HelloServiceImpl.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -43,3 +44,51 @@ public class HelloServiceImpl implements HelloService {
}
}
+=======
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.ws.policy.handler;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.rt.security.SecurityConstants;
+
+@WebService(name = "HelloPolicyService", serviceName = "HelloPolicyService")
+@EndpointProperties(value = {
+ @EndpointProperty(key = SecurityConstants.CALLBACK_HANDLER,
+ value = "org.apache.cxf.systest.ws.policy.handler.CommonPasswordCallback"),
+ @EndpointProperty(key = "ws-security.is-bsp-compliant", value = "false"),
+ @EndpointProperty(key = SecurityConstants.SIGNATURE_PROPERTIES, value = "alice.properties"),
+ @EndpointProperty(key = SecurityConstants.SIGNATURE_USERNAME, value = "alice")
+ })
+@HandlerChain(file = "handlers.xml")
+public class HelloServiceImpl implements HelloService {
+ @Override
+ @WebResult(name = "result")
+ public boolean checkHello(@WebParam(name = "input") String input) throws MyFault {
+ throw new MyFault("myMessage", "myFaultInfo");
+ }
+
+}
+>>>>>>> 428f770... Switching to use security constants in the tests instead of strings