You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2020/02/21 10:46:52 UTC

[cxf] branch master updated (224fa74 -> 88c383e)

This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from 224fa74  CXF-8149 Reduce synchronization in AbstractJXBProvider (#597)
     new fca1472  use DefaultBasicAuthSupplier.getBasicAuthHeader
     new 88c383e  Update to maven-enforcer-plugin 3.0.0-M3

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/it/jdk-cxf-with-toolchain/pom.xml          | 40 +++-------------------
 pom.xml                                            |  2 +-
 .../security/oauth2/client/OAuthClientUtils.java   | 12 ++-----
 .../http_jetty/JettyHTTPDestinationTest.java       |  5 ++-
 .../netty/server/NettyHttpDestinationTest.java     |  5 ++-
 .../http_undertow/UndertowHTTPDestinationTest.java |  5 ++-
 .../http/auth/DefaultBasicAuthSupplier.java        |  2 +-
 .../apache/cxf/transport/http/HTTPConduitTest.java |  9 +++--
 .../http/auth/DefaultBasicAuthSupplierTest.java}   | 18 +++++-----
 .../jaxrs/security/AbstractSpringSecurityTest.java | 13 +++----
 .../JAXRSJaasConfigurationSecurityTest.java        |  3 +-
 .../jaxrs/security/JAXRSJaasSecurityTest.java      |  3 +-
 .../systest/https/conduit/HTTPSConduitTest.java    |  6 ++--
 13 files changed, 37 insertions(+), 86 deletions(-)
 copy rt/{databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java => transports/http/src/test/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplierTest.java} (61%)


[cxf] 01/02: use DefaultBasicAuthSupplier.getBasicAuthHeader

Posted by bu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit fca1472e021feed0b470127dc5d71f646e1406f3
Author: amarkevich <am...@talend.com>
AuthorDate: Wed Apr 10 13:45:07 2019 +0300

    use DefaultBasicAuthSupplier.getBasicAuthHeader
---
 .../security/oauth2/client/OAuthClientUtils.java   | 12 ++-----
 .../http_jetty/JettyHTTPDestinationTest.java       |  5 ++-
 .../netty/server/NettyHttpDestinationTest.java     |  5 ++-
 .../http_undertow/UndertowHTTPDestinationTest.java |  5 ++-
 .../http/auth/DefaultBasicAuthSupplier.java        |  2 +-
 .../apache/cxf/transport/http/HTTPConduitTest.java |  9 +++---
 .../http/auth/DefaultBasicAuthSupplierTest.java    | 37 ++++++++++++++++++++++
 .../jaxrs/security/AbstractSpringSecurityTest.java | 13 +++-----
 .../JAXRSJaasConfigurationSecurityTest.java        |  3 +-
 .../jaxrs/security/JAXRSJaasSecurityTest.java      |  3 +-
 .../systest/https/conduit/HTTPSConduitTest.java    |  6 ++--
 11 files changed, 60 insertions(+), 40 deletions(-)

diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
index 81b92f0..0da1ce3 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
@@ -20,7 +20,6 @@ package org.apache.cxf.rs.security.oauth2.client;
 
 import java.io.InputStream;
 import java.net.URI;
-import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Map;
 
@@ -32,7 +31,6 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.rs.security.oauth2.common.AccessTokenGrant;
@@ -43,6 +41,7 @@ import org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.tokens.hawk.HawkAuthorizationScheme;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 
 /**
  * The utility class for simplifying working with OAuth servers
@@ -281,13 +280,8 @@ public final class OAuthClientUtils {
         if (consumer != null) {
             boolean secretAvailable = !StringUtils.isEmpty(consumer.getClientSecret());
             if (setAuthorizationHeader && secretAvailable) {
-                try {
-                    String data = Base64Utility.encode((consumer.getClientId() + ':' + consumer.getClientSecret())
-                            .getBytes(StandardCharsets.UTF_8));
-                    accessTokenService.replaceHeader(HttpHeaders.AUTHORIZATION, "Basic " + data);
-                } catch (Exception ex) {
-                    throw new ProcessingException(ex);
-                }
+                accessTokenService.replaceHeader(HttpHeaders.AUTHORIZATION,
+                    DefaultBasicAuthSupplier.getBasicAuthHeader(consumer.getClientId(), consumer.getClientSecret()));
             } else {
                 form.param(OAuthConstants.CLIENT_ID, consumer.getClientId());
                 if (secretAvailable) {
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
index 7782584..f2262a2 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
@@ -42,7 +42,6 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.continuations.SuspendedInvocationException;
@@ -65,6 +64,7 @@ import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.ContinuationProviderFactory;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -90,8 +90,7 @@ public class JettyHTTPDestinationTest {
     protected static final String AUTH_HEADER = "Authorization";
     protected static final String USER = "copernicus";
     protected static final String PASSWD = "epicycles";
-    protected static final String BASIC_AUTH =
-        "Basic " + Base64Utility.encode((USER + ":" + PASSWD).getBytes());
+    protected static final String BASIC_AUTH = DefaultBasicAuthSupplier.getBasicAuthHeader(USER, PASSWD);
 
     private static final String NOWHERE = "http://nada.nothing.nowhere.null/";
     private static final String PAYLOAD = "message payload";
diff --git a/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java b/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
index 7de6544..7aae458 100644
--- a/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
+++ b/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
@@ -43,7 +43,6 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.continuations.SuspendedInvocationException;
@@ -66,6 +65,7 @@ import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.ContinuationProviderFactory;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.cxf.transport.http.netty.server.util.Utils;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AddressingProperties;
@@ -89,8 +89,7 @@ public class NettyHttpDestinationTest {
     protected static final String AUTH_HEADER = "Authorization";
     protected static final String USER = "copernicus";
     protected static final String PASSWD = "epicycles";
-    protected static final String BASIC_AUTH =
-        "Basic " + Base64Utility.encode((USER + ":" + PASSWD).getBytes());
+    protected static final String BASIC_AUTH = DefaultBasicAuthSupplier.getBasicAuthHeader(USER, PASSWD);
 
     private static final String NOWHERE = "http://nada.nothing.nowhere.null/";
     private static final String PAYLOAD = "message payload";
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
index dbbadce..77d670c 100644
--- a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
@@ -43,7 +43,6 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.continuations.SuspendedInvocationException;
@@ -66,6 +65,7 @@ import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.ContinuationProviderFactory;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -92,8 +92,7 @@ public class UndertowHTTPDestinationTest {
     protected static final String AUTH_HEADER = "Authorization";
     protected static final String USER = "copernicus";
     protected static final String PASSWD = "epicycles";
-    protected static final String BASIC_AUTH =
-        "Basic " + Base64Utility.encode((USER + ":" + PASSWD).getBytes());
+    protected static final String BASIC_AUTH = DefaultBasicAuthSupplier.getBasicAuthHeader(USER, PASSWD);
 
     private static final String NOWHERE = "http://nada.nothing.nowhere.null/";
     private static final String PAYLOAD = "message payload";
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
index 071e129..ccb7cc9 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
@@ -41,7 +41,7 @@ public final class DefaultBasicAuthSupplier implements HttpAuthSupplier {
     }
 
     public static String getBasicAuthHeader(String userName, String passwd, boolean useIso8859) {
-        String userAndPass = userName + ":" + passwd;
+        final String userAndPass = userName + ':' + passwd;
         byte[] authBytes = useIso8859 ? userAndPass.getBytes(StandardCharsets.ISO_8859_1) : userAndPass.getBytes();
         return "Basic " + Base64Utility.encode(authBytes);
     }
diff --git a/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java b/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
index cce33b0..520d7a0 100644
--- a/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
+++ b/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
@@ -31,7 +31,6 @@ import java.util.concurrent.RejectedExecutionException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointImpl;
@@ -42,6 +41,7 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.HTTPConduit.WrappedOutputStream;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.cxf.transport.http.auth.HttpAuthSupplier;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -171,7 +171,7 @@ public class HTTPConduitTest {
                 headers.get("Authorization"));
 
         assertEquals("Unexpected Authorization Token",
-                "Basic " + Base64Utility.encode("testUser:password".getBytes()),
+            DefaultBasicAuthSupplier.getBasicAuthHeader("testUser", "password"),
                 headers.get("Authorization").get(0));
     }
 
@@ -203,7 +203,7 @@ public class HTTPConduitTest {
                 headers.get("Authorization"));
 
         assertEquals("Unexpected Authorization Token",
-                "Basic " + Base64Utility.encode("Satan:hell".getBytes()),
+            DefaultBasicAuthSupplier.getBasicAuthHeader("Satan", "hell"),
                 headers.get("Authorization").get(0));
 
         // Setting a Basic Auth User Pass should override
@@ -235,7 +235,7 @@ public class HTTPConduitTest {
             CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
 
         assertEquals("Unexpected Authorization Token",
-                "Basic " + Base64Utility.encode("Hello:world".getBytes()),
+            DefaultBasicAuthSupplier.getBasicAuthHeader("Hello", "world"),
                 headers.get("Authorization").get(0));
     }
 
@@ -281,7 +281,6 @@ public class HTTPConduitTest {
                 assertEquals("expected", ex.getMessage());
             }
         } catch (Exception ex) {
-            ex.printStackTrace();
             throw ex;
         }
     }
diff --git a/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplierTest.java b/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplierTest.java
new file mode 100644
index 0000000..d5c8009
--- /dev/null
+++ b/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplierTest.java
@@ -0,0 +1,37 @@
+/**
+ * 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.transport.http.auth;
+
+import org.apache.cxf.common.util.StringUtils;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+
+public class DefaultBasicAuthSupplierTest {
+
+    @Test
+    public void testGetBasicAuthHeader() {
+        assertFalse(StringUtils.isEmpty(DefaultBasicAuthSupplier.getBasicAuthHeader(null, null)));
+        assertFalse(StringUtils.isEmpty(DefaultBasicAuthSupplier.getBasicAuthHeader("u", null)));
+        assertFalse(StringUtils.isEmpty(DefaultBasicAuthSupplier.getBasicAuthHeader(null, "p")));
+        assertFalse(StringUtils.isEmpty(DefaultBasicAuthSupplier.getBasicAuthHeader("u", "p")));
+    }
+
+}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
index 9cbded9..09af496 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
@@ -21,9 +21,9 @@ package org.apache.cxf.systest.jaxrs.security;
 
 import java.io.InputStream;
 
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.http.HttpHeaders;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.RequestBuilder;
@@ -35,16 +35,13 @@ import static org.junit.Assert.assertEquals;
 
 public abstract class AbstractSpringSecurityTest extends AbstractBusClientServerTestBase {
 
-    protected static String basicAuthHeader(String user, String password) {
-        return "Basic " + Base64Utility.encode((user + ':' + password).getBytes());
-    }
-
     protected void getBook(String endpointAddress, String user, String password, int expectedStatus) throws Exception {
         try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
             CloseableHttpResponse response = client.execute(RequestBuilder
-                    .get(endpointAddress)
-                    .addHeader(HttpHeaders.ACCEPT, "application/xml")
-                    .addHeader(HttpHeaders.AUTHORIZATION, basicAuthHeader(user, password)).build());
+                .get(endpointAddress)
+                .addHeader(HttpHeaders.ACCEPT, "application/xml")
+                .addHeader(HttpHeaders.AUTHORIZATION, DefaultBasicAuthSupplier.getBasicAuthHeader(user, password))
+                    .build());
             assertEquals(expectedStatus, response.getStatusLine().getStatusCode());
             if (expectedStatus == 200) {
                 try (InputStream expected = getClass()
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasConfigurationSecurityTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasConfigurationSecurityTest.java
index 46bf3f8..72d193e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasConfigurationSecurityTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasConfigurationSecurityTest.java
@@ -60,9 +60,8 @@ public class JAXRSJaasConfigurationSecurityTest extends AbstractSpringSecurityTe
     public void testJaasFilterAuthenticationFailure() throws Exception {
         String endpointAddress =
             "http://localhost:" + PORT + "/service/jaasConfigFilter/bookstorestorage/thosebooks/123";
-        WebClient wc = WebClient.create(endpointAddress);
+        WebClient wc = WebClient.create(endpointAddress, "foo", "bar1", null);
         wc.accept("text/xml");
-        wc.header(HttpHeaders.AUTHORIZATION, basicAuthHeader("foo", "bar1"));
         Response r = wc.get();
         assertEquals(401, r.getStatus());
         Object wwwAuthHeader = r.getMetadata().getFirst(HttpHeaders.WWW_AUTHENTICATE);
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasSecurityTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasSecurityTest.java
index 114a46e..426694f 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasSecurityTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSJaasSecurityTest.java
@@ -127,9 +127,8 @@ public class JAXRSJaasSecurityTest extends AbstractSpringSecurityTest {
     public void testJaasFilterAuthenticationFailureWithRedirection() throws Exception {
         String endpointAddress =
             "http://localhost:" + PORT + "/service/jaas2/bookstorestorage/thosebooks/123";
-        WebClient wc = WebClient.create(endpointAddress);
+        WebClient wc = WebClient.create(endpointAddress, "foo", "bar1", null);
         wc.accept("text/xml,text/html");
-        wc.header(HttpHeaders.AUTHORIZATION, basicAuthHeader("foo", "bar1"));
         Response r = wc.get();
         assertEquals(307, r.getStatus());
         Object locationHeader = r.getMetadata().getFirst(HttpHeaders.LOCATION);
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/https/conduit/HTTPSConduitTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/https/conduit/HTTPSConduitTest.java
index 2a00593..7a2326c 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/https/conduit/HTTPSConduitTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/https/conduit/HTTPSConduitTest.java
@@ -42,7 +42,6 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.BusApplicationContext;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.configuration.jsse.TLSClientParameters;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Client;
@@ -54,6 +53,7 @@ import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transport.http.MessageTrustDecider;
 import org.apache.cxf.transport.http.URLConnectionInfo;
 import org.apache.cxf.transport.http.UntrustedURLConnectionIOException;
+import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
 import org.apache.cxf.transport.http.auth.HttpAuthHeader;
 import org.apache.cxf.transport.http.auth.HttpAuthSupplier;
 import org.apache.cxf.transport.https.HttpsURLConnectionInfo;
@@ -681,9 +681,7 @@ public class HTTPSConduitTest extends AbstractBusClientServerTestBase {
         }
 
         private String createUserPass(String usr, String pwd) {
-            String userpass = usr + ":" + pwd;
-            String token = Base64Utility.encode(userpass.getBytes());
-            return "Basic " + token;
+            return DefaultBasicAuthSupplier.getBasicAuthHeader(usr, pwd);
         }
 
         public boolean requiresRequestCaching() {


[cxf] 02/02: Update to maven-enforcer-plugin 3.0.0-M3

Posted by bu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 88c383efb0b4d8e0aba4590f762676cb8b65d4aa
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Fri Feb 21 13:30:59 2020 +0300

    Update to maven-enforcer-plugin 3.0.0-M3
---
 .../src/it/jdk-cxf-with-toolchain/pom.xml          | 40 +++-------------------
 pom.xml                                            |  2 +-
 2 files changed, 5 insertions(+), 37 deletions(-)

diff --git a/maven-plugins/codegen-plugin/src/it/jdk-cxf-with-toolchain/pom.xml b/maven-plugins/codegen-plugin/src/it/jdk-cxf-with-toolchain/pom.xml
index dd38ac0..9cfb2cd 100644
--- a/maven-plugins/codegen-plugin/src/it/jdk-cxf-with-toolchain/pom.xml
+++ b/maven-plugins/codegen-plugin/src/it/jdk-cxf-with-toolchain/pom.xml
@@ -17,7 +17,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
-        <version>3.0.0-M2</version>
+        <version>3.0.0-M3</version>
         <executions>
           <execution>
             <id>enforce-jdk9-of-higher</id>
@@ -28,7 +28,7 @@
             <configuration>
               <rules>
                 <requireJavaVersion>
-                  <version>[1.9,)</version>
+                  <version>[9,)</version>
                 </requireJavaVersion>
               </rules>
             </configuration>
@@ -80,41 +80,9 @@
   </build>
   <profiles>
     <profile><!-- used to avoid integration test failures for devs that have no toolchain config -->
-      <id>toolchain-java9</id>
-      <activation>
-        <jdk>9</jdk>
-        <property><!-- Jenkins -->
-          <name>env.BUILD_NUMBER</name>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-toolchains-plugin</artifactId>
-            <version>1.1</version>
-            <configuration>
-              <toolchains>
-                <jdk>
-                  <version>1.9</version>
-                </jdk>
-              </toolchains>
-            </configuration>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>toolchain</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile><!-- used to avoid integration test failures for devs that have no toolchain config -->
       <id>toolchain</id>
       <activation>
-        <jdk>[10,)</jdk>
+        <jdk>[9,)</jdk>
         <property><!-- Jenkins -->
           <name>env.BUILD_NUMBER</name>
         </property>
@@ -124,7 +92,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-toolchains-plugin</artifactId>
-            <version>1.1</version>
+            <version>3.0.0</version>
             <configuration>
               <toolchains>
                 <jdk>
diff --git a/pom.xml b/pom.xml
index e36981b..f9e707c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -667,7 +667,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-enforcer-plugin</artifactId>
-                    <version>3.0.0-M2</version>
+                    <version>3.0.0-M3</version>
                     <configuration>
                         <rules>
                             <requireMavenVersion>