Skip to content

Commit

Permalink
[WAGON-627] Maven deploy fails with 401 Unauthorized when using £ in …
Browse files Browse the repository at this point in the history
…password

When configuring preemptive authentication we need to make sure that it uses
the same character encoding as the custom auth scheme registry. Then characters
are properly encoded into bytes.

This closes #83
  • Loading branch information
michael-o committed Jun 17, 2022
1 parent 8e5a4b6 commit d7f3367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ private void put( int wait, Resource resource, File source, HttpEntity httpEntit

if ( credentialsProvider.getCredentials( targetScope ) != null )
{
BasicScheme targetAuth = new BasicScheme();
BasicScheme targetAuth = new BasicScheme( StandardCharsets.UTF_8 );
authCache.put( targetHost, targetAuth );
}

Expand Down Expand Up @@ -978,7 +978,7 @@ protected CloseableHttpResponse execute( HttpUriRequest httpMethod )

if ( credentialsProvider.getCredentials( targetScope ) != null )
{
BasicScheme targetAuth = new BasicScheme();
BasicScheme targetAuth = new BasicScheme( StandardCharsets.UTF_8 );
authCache.put( targetHost, targetAuth );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -165,7 +166,7 @@ private int doMkCol( String url )

if ( getCredentialsProvider().getCredentials( targetScope ) != null )
{
BasicScheme targetAuth = new BasicScheme();
BasicScheme targetAuth = new BasicScheme( StandardCharsets.UTF_8 );
getAuthCache().put( targetHost, targetAuth );
}
HttpMkcol method = new HttpMkcol( url );
Expand Down

0 comments on commit d7f3367

Please sign in to comment.