}
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() )
{
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() );
proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(),
proxy.getPort(), authBuilder.build() ),
proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
for ( Server server : decrypted.getServers() )
{
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() );
authBuilder.addPrivateKey( server.getPrivateKey(), server.getPassphrase() );
authSelector.add( server.getId(), authBuilder.build() );