Search in sources :

Example 1 with AuthenticationContext

use of org.eclipse.aether.repository.AuthenticationContext 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");
}
Also used : AuthenticationContext(org.eclipse.aether.repository.AuthenticationContext) Authentication(org.eclipse.aether.repository.Authentication) RemoteRepository(org.eclipse.aether.repository.RemoteRepository)

Example 2 with AuthenticationContext

use of org.eclipse.aether.repository.AuthenticationContext in project spring-boot by spring-projects.

the class SettingsXmlRepositorySystemSessionAutoConfigurationTests method assertProxySelectorConfiguration.

private void assertProxySelectorConfiguration(DefaultRepositorySystemSession session, RemoteRepository repository) {
    Proxy proxy = session.getProxySelector().getProxy(repository);
    repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
    AuthenticationContext authenticationContext = AuthenticationContext.forProxy(session, repository);
    assertThat(proxy.getHost()).isEqualTo("proxy.example.com");
    assertThat(authenticationContext.get(AuthenticationContext.USERNAME)).isEqualTo("proxyuser");
    assertThat(authenticationContext.get(AuthenticationContext.PASSWORD)).isEqualTo("somepassword");
}
Also used : Proxy(org.eclipse.aether.repository.Proxy) AuthenticationContext(org.eclipse.aether.repository.AuthenticationContext) RemoteRepository(org.eclipse.aether.repository.RemoteRepository)

Aggregations

AuthenticationContext (org.eclipse.aether.repository.AuthenticationContext)2 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)2 Authentication (org.eclipse.aether.repository.Authentication)1 Proxy (org.eclipse.aether.repository.Proxy)1