get MVNW_USERNAME and MVNW_PASSWORD from env

when auth for the http proxy, MVNW_{USERNAME,PASSWORD} should be fetched via `System.getenv`.
This commit is contained in:
James Z.M. Gao 2020-05-24 22:36:14 +08:00 committed by rfscholte
parent 14449e426a
commit 6fba7aa3c4
1 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ private void configureProxyAuthentication()
private void configureAuthentication() private void configureAuthentication()
{ {
if ( System.getProperty( "MVNW_USERNAME" ) != null && System.getProperty( "MVNW_PASSWORD" ) != null if ( System.getenv( MVNW_USERNAME ) != null && System.getenv( MVNW_PASSWORD ) != null
&& System.getProperty( "http.proxyUser" ) == null ) && System.getProperty( "http.proxyUser" ) == null )
{ {
Authenticator.setDefault( new Authenticator() Authenticator.setDefault( new Authenticator()
@ -76,8 +76,8 @@ private void configureAuthentication()
@Override @Override
protected PasswordAuthentication getPasswordAuthentication() protected PasswordAuthentication getPasswordAuthentication()
{ {
return new PasswordAuthentication( System.getProperty( "MVNW_USERNAME" ), return new PasswordAuthentication( System.getenv( MVNW_USERNAME ),
System.getProperty( "MVNW_PASSWORD" ).toCharArray() ); System.getenv( MVNW_PASSWORD ).toCharArray() );
} }
} ); } );
} }