Search in sources :

Example 1 with AuthenticationStrategyFactory

use of com.opentext.ia.sdk.client.api.AuthenticationStrategyFactory in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class PropertiesBasedConfigurer method initRestClient.

private void initRestClient() throws IOException {
    if (restClient == null) {
        HttpClient httpClient = NewInstance.fromConfiguration(configuration, HTTP_CLIENT_CLASSNAME, ApacheHttpClient.class.getName()).as(HttpClient.class);
        AuthenticationStrategy authentication = new AuthenticationStrategyFactory(getServerConfiguration()).getAuthenticationStrategy(() -> httpClient, () -> clock);
        restClient = new RestClient(httpClient);
        restClient.init(authentication);
    }
    cache.setServices(restClient.get(configured(SERVER_URI), Services.class));
}
Also used : AuthenticationStrategyFactory(com.opentext.ia.sdk.client.api.AuthenticationStrategyFactory) ApacheHttpClient(com.opentext.ia.sdk.support.http.apache.ApacheHttpClient) AuthenticationStrategy(com.opentext.ia.sdk.support.http.rest.AuthenticationStrategy) RestClient(com.opentext.ia.sdk.support.http.rest.RestClient)

Example 2 with AuthenticationStrategyFactory

use of com.opentext.ia.sdk.client.api.AuthenticationStrategyFactory in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class ArchiveClients method createRestClient.

private static RestClient createRestClient(ServerConfiguration configuration, Clock clock) {
    HttpClient httpClient = NewInstance.of(configuration.getHttpClientClassName(), ApacheHttpClient.class.getName()).as(HttpClient.class);
    AuthenticationStrategy authentication = new AuthenticationStrategyFactory(configuration).getAuthenticationStrategy(() -> httpClient, () -> clock);
    RestClient result = new RestClient(httpClient);
    result.init(authentication);
    return result;
}
Also used : AuthenticationStrategyFactory(com.opentext.ia.sdk.client.api.AuthenticationStrategyFactory) HttpClient(com.opentext.ia.sdk.support.http.HttpClient) ApacheHttpClient(com.opentext.ia.sdk.support.http.apache.ApacheHttpClient) AuthenticationStrategy(com.opentext.ia.sdk.support.http.rest.AuthenticationStrategy) InfoArchiveRestClient(com.opentext.ia.sdk.client.impl.InfoArchiveRestClient) RestClient(com.opentext.ia.sdk.support.http.rest.RestClient)

Aggregations

AuthenticationStrategyFactory (com.opentext.ia.sdk.client.api.AuthenticationStrategyFactory)2 ApacheHttpClient (com.opentext.ia.sdk.support.http.apache.ApacheHttpClient)2 AuthenticationStrategy (com.opentext.ia.sdk.support.http.rest.AuthenticationStrategy)2 RestClient (com.opentext.ia.sdk.support.http.rest.RestClient)2 InfoArchiveRestClient (com.opentext.ia.sdk.client.impl.InfoArchiveRestClient)1 HttpClient (com.opentext.ia.sdk.support.http.HttpClient)1