org.springframework.http.client.support.BasicAuthenticationInterceptor Java Examples

The following examples show how to use org.springframework.http.client.support.BasicAuthenticationInterceptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestTemplateFactory.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
    HttpHost host = new HttpHost("localhost", 8082, "http");
    final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryBasicAuth(host);
    restTemplate = new RestTemplate(requestFactory);
    restTemplate.getInterceptors().add(new BasicAuthenticationInterceptor("user1", "user1Pass"));
}
 
Example #2
Source File: RestTemplateFactory.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
    HttpHost host = new HttpHost("localhost", 8082, "http");
    final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryBasicAuth(host);
    restTemplate = new RestTemplate(requestFactory);
    restTemplate.getInterceptors().add(new BasicAuthenticationInterceptor("user1", "user1Pass"));
}
 
Example #3
Source File: UserAuthorities.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
public void ensureUserAuthIsSet() {
    if (restTemplate.getInterceptors().stream().noneMatch(i -> i instanceof BasicAuthenticationInterceptor)) {
        setAuthUserRole(null); // => Active le profil par défault (lambda)
    }
}
 
Example #4
Source File: AuthorizationCredentialsConfig.java    From hesperides with GNU General Public License v3.0 4 votes vote down vote up
public BasicAuthenticationInterceptor getBasicAuthInterceptorForTestProfile(String testProfile) {
    return new BasicAuthenticationInterceptor(getTestProfileUsername(testProfile),
            getTestProfilePassword(testProfile));
}