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 2015/07/15 18:16:53 UTC
[1/2] cxf git commit: Adding WSDL retrieval tests when basic auth +
digest auth is configured
Repository: cxf
Updated Branches:
refs/heads/3.0.x-fixes 02ec499af -> 0d3318d2c
Adding WSDL retrieval tests when basic auth + digest auth is configured
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/418a19b1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/418a19b1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/418a19b1
Branch: refs/heads/3.0.x-fixes
Commit: 418a19b19851abeca31492bdf791a6bf0a8a360b
Parents: 02ec499
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Jul 15 16:59:33 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Jul 15 17:00:03 2015 +0100
----------------------------------------------------------------------
.../systest/http_jetty/JettyBasicAuthTest.java | 35 ++++++++++++++++++--
.../systest/http_jetty/JettyDigestAuthTest.java | 33 ++++++++++++++++--
2 files changed, 64 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/418a19b1/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyBasicAuthTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyBasicAuthTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyBasicAuthTest.java
index 1839ba0..3072280 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyBasicAuthTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyBasicAuthTest.java
@@ -24,15 +24,21 @@ import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.CXFBusFactory;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.HTTPConduitConfigurer;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.SOAPService;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Test;
/**
* Tests thread pool config.
@@ -64,8 +70,33 @@ public class JettyBasicAuthTest extends AbstractClientServerTestBase {
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
}
- @Test
+ @org.junit.Test
public void testBasicAuth() throws Exception {
assertEquals("Hello Alice", greeter.greetMe("Alice"));
}
+
+ @org.junit.Test
+ public void testGetWSDL() throws Exception {
+ BusFactory bf = CXFBusFactory.newInstance();
+ Bus bus = bf.createBus();
+ bus.getInInterceptors().add(new LoggingInInterceptor());
+ bus.getOutInterceptors().add(new LoggingOutInterceptor());
+
+ MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
+ bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
+ JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
+ factory.createClient(ADDRESS + "?wsdl");
+ }
+
+ private static class MyHTTPConduitConfigurer implements HTTPConduitConfigurer {
+ public void configure(String name, String address, HTTPConduit c) {
+
+ AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
+
+ authorizationPolicy.setUserName("ffang");
+ authorizationPolicy.setPassword("pswd");
+ authorizationPolicy.setAuthorizationType("Basic");
+ c.setAuthorization(authorizationPolicy);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/418a19b1/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyDigestAuthTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyDigestAuthTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyDigestAuthTest.java
index 11caafd..fe6e106 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyDigestAuthTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/JettyDigestAuthTest.java
@@ -28,18 +28,23 @@ import javax.xml.ws.Endpoint;
import javax.xml.ws.WebServiceException;
import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.HTTPConduitConfigurer;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.cxf.transport.http.auth.DigestAuthSupplier;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -47,7 +52,6 @@ import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.SOAPService;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
-
import org.junit.BeforeClass;
import org.junit.Test;
@@ -147,7 +151,7 @@ public class JettyDigestAuthTest extends AbstractClientServerTestBase {
//which async client can handle but we cannot.
doTest(true);
}
-
+
private void doTest(boolean async) throws Exception {
setupClient(async);
assertEquals("Hello Alice", greeter.greetMe("Alice"));
@@ -168,4 +172,29 @@ public class JettyDigestAuthTest extends AbstractClientServerTestBase {
//ignore - expected
}
}
+
+ @org.junit.Test
+ public void testGetWSDL() throws Exception {
+ BusFactory bf = CXFBusFactory.newInstance();
+ Bus bus = bf.createBus();
+ bus.getInInterceptors().add(new LoggingInInterceptor());
+ bus.getOutInterceptors().add(new LoggingOutInterceptor());
+
+ MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
+ bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
+ JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
+ factory.createClient(ADDRESS + "?wsdl");
+ }
+
+ private static class MyHTTPConduitConfigurer implements HTTPConduitConfigurer {
+ public void configure(String name, String address, HTTPConduit c) {
+
+ AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
+
+ authorizationPolicy.setUserName("ffang");
+ authorizationPolicy.setPassword("pswd");
+ authorizationPolicy.setAuthorizationType("Digest");
+ c.setAuthorization(authorizationPolicy);
+ }
+ }
}
[2/2] cxf git commit: Fixing build
Posted by co...@apache.org.
Fixing build
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0d3318d2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0d3318d2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0d3318d2
Branch: refs/heads/3.0.x-fixes
Commit: 0d3318d2cb5fc0e7c20e14dcc242865ef11175d5
Parents: 418a19b
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Jul 15 17:15:55 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Jul 15 17:15:55 2015 +0100
----------------------------------------------------------------------
.../rs/security/xml/XmlSecInInterceptor.java | 38 ++++++++++----------
1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/0d3318d2/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java
index 03c4dd9..21b431b 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java
@@ -240,19 +240,19 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
if (XMLSecurityConstants.Enc.equals(event.getAlgorithmUsage())
&& encryptionProperties.getEncryptionSymmetricKeyAlgo() != null
&& !encryptionProperties.getEncryptionSymmetricKeyAlgo().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The symmetric encryption algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The symmetric encryption algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
} else if ((XMLSecurityConstants.Sym_Key_Wrap.equals(event.getAlgorithmUsage())
|| XMLSecurityConstants.Asym_Key_Wrap.equals(event.getAlgorithmUsage()))
&& encryptionProperties.getEncryptionKeyTransportAlgo() != null
&& !encryptionProperties.getEncryptionKeyTransportAlgo().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The key transport algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The key transport algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
} else if (XMLSecurityConstants.EncDig.equals(event.getAlgorithmUsage())
&& encryptionProperties.getEncryptionDigestAlgo() != null
&& !encryptionProperties.getEncryptionDigestAlgo().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The encryption digest algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The encryption digest algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
}
}
@@ -262,24 +262,24 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
|| XMLSecurityConstants.Sym_Sig.equals(event.getAlgorithmUsage()))
&& sigProps.getSignatureAlgo() != null
&& !sigProps.getSignatureAlgo().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The signature algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The signature algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
} else if (XMLSecurityConstants.SigDig.equals(event.getAlgorithmUsage())
&& sigProps.getSignatureDigestAlgo() != null
&& !sigProps.getSignatureDigestAlgo().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The signature digest algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The signature digest algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
} else if (XMLSecurityConstants.SigC14n.equals(event.getAlgorithmUsage())
&& sigProps.getSignatureC14nMethod() != null
&& !sigProps.getSignatureC14nMethod().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The signature c14n algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The signature c14n algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
} else if (XMLSecurityConstants.SigTransform.equals(event.getAlgorithmUsage())
&& !XMLSecurityConstants.NS_XMLDSIG_ENVELOPED_SIGNATURE.equals(event.getAlgorithmURI())
&& sigProps.getSignatureC14nTransform() != null
&& !sigProps.getSignatureC14nTransform().equals(event.getAlgorithmURI())) {
- throw new XMLSecurityException("empty", "The signature transformation algorithm "
- + event.getAlgorithmURI() + " is not allowed");
+ throw new XMLSecurityException("empty", new Object[] {"The signature transformation algorithm "
+ + event.getAlgorithmURI() + " is not allowed"});
}
}
@@ -299,8 +299,8 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
try {
new TrustValidator().validateTrust(sigCrypto, cert, publicKey, subjectDNPatterns);
} catch (WSSecurityException e) {
- throw new XMLSecurityException("empty", "Error during Signature Trust "
- + "validation: " + e.getMessage());
+ throw new XMLSecurityException("empty", new Object[] {"Error during Signature Trust "
+ + "validation: " + e.getMessage()});
}
if (persistSignature) {
@@ -408,7 +408,7 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
if (incomingSecurityEventList == null) {
LOG.warning("Security processing failed (actions mismatch)");
XMLSecurityException ex =
- new XMLSecurityException("empty", "The request was not signed or encrypted");
+ new XMLSecurityException("empty", new Object[] {"The request was not signed or encrypted"});
throwFault(ex.getMessage(), ex);
}
@@ -417,7 +417,7 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
if (!isEventInResults(requiredEvent, incomingSecurityEventList)) {
LOG.warning("The request was not signed");
XMLSecurityException ex =
- new XMLSecurityException("empty", "The request was not signed");
+ new XMLSecurityException("empty", new Object[] {"The request was not signed"});
throwFault(ex.getMessage(), ex);
}
}
@@ -428,7 +428,7 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> {
if (!foundEncryptionPart) {
LOG.warning("The request was not encrypted");
XMLSecurityException ex =
- new XMLSecurityException("empty", "The request was not encrypted");
+ new XMLSecurityException("empty", new Object[] {"The request was not encrypted"});
throwFault(ex.getMessage(), ex);
}
}