use of org.gradle.internal.resource.transport.http.ntlm.NTLMCredentials in project gradle by gradle.
the class HttpClientConfigurer method useCredentials.
private void useCredentials(CredentialsProvider credentialsProvider, String host, int port, Collection<? extends Authentication> authentications) {
Credentials httpCredentials;
for (Authentication authentication : authentications) {
String scheme = getAuthScheme(authentication);
PasswordCredentials credentials = getPasswordCredentials(authentication);
if (authentication instanceof AllSchemesAuthentication) {
NTLMCredentials ntlmCredentials = new NTLMCredentials(credentials);
httpCredentials = new NTCredentials(ntlmCredentials.getUsername(), ntlmCredentials.getPassword(), ntlmCredentials.getWorkstation(), ntlmCredentials.getDomain());
credentialsProvider.setCredentials(new AuthScope(host, port, AuthScope.ANY_REALM, AuthSchemes.NTLM), httpCredentials);
LOGGER.debug("Using {} and {} for authenticating against '{}:{}' using {}", credentials, ntlmCredentials, host, port, AuthSchemes.NTLM);
}
httpCredentials = new UsernamePasswordCredentials(credentials.getUsername(), credentials.getPassword());
credentialsProvider.setCredentials(new AuthScope(host, port, AuthScope.ANY_REALM, scheme), httpCredentials);
LOGGER.debug("Using {} for authenticating against '{}:{}' using {}", credentials, host, port, scheme);
}
}
Aggregations