{
RemoteRepository repo = RepositoryUtils.toRepo( repository );
org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo );
if ( proxy != null )
{
Proxy p = new Proxy();
p.setHost( proxy.getHost() );
p.setProtocol( proxy.getType() );
p.setPort( proxy.getPort() );
if ( proxy.getAuthentication() != null )
{
repo = new RemoteRepository.Builder( repo ).setProxy( proxy ).build();
AuthenticationContext authCtx = AuthenticationContext.forProxy( session, repo );
p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) );
p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) );
p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) );
p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION ) );
authCtx.close();
}
return p;
}
}