}
DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest();
decrypt.setProxies( request.getProxies() );
decrypt.setServers( request.getServers() );
SettingsDecryptionResult decrypted = settingsDecrypter.decrypt( decrypt );
if ( logger.isDebugEnabled() )
{
for ( SettingsProblem problem : decrypted.getProblems() )
{
logger.debug( problem.getMessage(), problem.getException() );
}
}
DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
for ( Mirror mirror : request.getMirrors() )
{
mirrorSelector.add( mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
mirror.getMirrorOfLayouts() );
}
session.setMirrorSelector( mirrorSelector );
DefaultProxySelector proxySelector = new DefaultProxySelector();
for ( Proxy proxy : decrypted.getProxies() )
{
Authentication proxyAuth = new Authentication( proxy.getUsername(), proxy.getPassword() );
proxySelector.add( new org.sonatype.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(),
proxyAuth ), proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
for ( Server server : decrypted.getServers() )
{
Authentication auth =
new Authentication( server.getUsername(), server.getPassword(), server.getPrivateKey(),
server.getPassphrase() );
authSelector.add( server.getId(), auth );