use of org.eclipse.aether.repository.Authentication in project spring-boot by spring-projects.
the class SettingsXmlRepositorySystemSessionAutoConfigurationTests method assertAuthenticationSelectorConfiguration.
private void assertAuthenticationSelectorConfiguration(DefaultRepositorySystemSession session, RemoteRepository repository) {
Authentication authentication = session.getAuthenticationSelector().getAuthentication(repository);
repository = new RemoteRepository.Builder(repository).setAuthentication(authentication).build();
AuthenticationContext authenticationContext = AuthenticationContext.forRepository(session, repository);
assertThat(authenticationContext.get(AuthenticationContext.USERNAME)).isEqualTo("tester");
assertThat(authenticationContext.get(AuthenticationContext.PASSWORD)).isEqualTo("secret");
}
use of org.eclipse.aether.repository.Authentication in project buck by facebook.
the class AetherUtil method toRemoteRepository.
public static RemoteRepository toRemoteRepository(String repoUrl, Optional<String> username, Optional<String> password) {
RemoteRepository.Builder repo = new RemoteRepository.Builder(null, "default", repoUrl).setPolicy(new RepositoryPolicy(true, null, CHECKSUM_POLICY_FAIL));
if (username.isPresent() && password.isPresent()) {
Authentication authentication = new AuthenticationBuilder().addUsername(username.get()).addPassword(password.get()).build();
repo.setAuthentication(authentication);
}
return repo.build();
}
use of org.eclipse.aether.repository.Authentication in project spring-boot by spring-projects.
the class MavenSettings method createProxySelector.
private ProxySelector createProxySelector(SettingsDecryptionResult decryptedSettings) {
DefaultProxySelector selector = new DefaultProxySelector();
for (Proxy proxy : decryptedSettings.getProxies()) {
Authentication authentication = new AuthenticationBuilder().addUsername(proxy.getUsername()).addPassword(proxy.getPassword()).build();
selector.add(new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authentication), proxy.getNonProxyHosts());
}
return selector;
}
Aggregations