Created
August 5, 2015 21:52
-
-
Save mstine/e086fad2f1b61de4634e to your computer and use it in GitHub Desktop.
receptor client + basic auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public ReceptorClient receptorClient() { | |
CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); | |
credentialsProvider.setCredentials( | |
new AuthScope(receptorUri, 80), | |
new UsernamePasswordCredentials(receptorUser, receptorPassword) | |
); | |
CloseableHttpClient httpClient = HttpClients.custom() | |
.setDefaultCredentialsProvider(credentialsProvider) | |
.build(); | |
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); | |
return new ReceptorClient(receptorUri, factory); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment