@@ -108,6 +108,8 @@ public class JdkHttpClient implements HttpClient {
108108
109109 Credentials credentials = config .credentials ();
110110 String info = config .baseUri ().getUserInfo ();
111+ URI baseUri = config .baseUri ();
112+
111113 if (info != null && !info .trim ().isEmpty ()) {
112114 String [] parts = info .split (":" , 2 );
113115 String username = parts [0 ];
@@ -121,6 +123,20 @@ protected PasswordAuthentication getPasswordAuthentication() {
121123 }
122124 };
123125 builder = builder .authenticator (authenticator );
126+
127+ // Remove credentials from URL
128+ try {
129+ config = ClientConfig .defaultConfig ().baseUri (new URI (
130+ config .baseUri ().getScheme (),
131+ null ,
132+ config .baseUri ().getHost (),
133+ config .baseUri ().getPort (),
134+ config .baseUri ().getPath (),
135+ config .baseUri ().getQuery (),
136+ config .baseUri ().getFragment ()));
137+ } catch (URISyntaxException e ) {
138+ LOG .log (Level .WARNING , "Could not strip credentials from URI" , e );
139+ }
124140 } else if (credentials != null ) {
125141 if (!(credentials instanceof UsernameAndPassword )) {
126142 throw new IllegalArgumentException (
0 commit comments