public static HttpClientContext httpContext(AuthCache authCache, CredentialsProvider provider) { // Add AuthCache to the execution context HttpClientContext localContext = HttpClientContext.create(); return httpContext(localContext, authCache, provider); }
public static HttpClientContext httpContext(AuthCache authCache, CredentialsProvider provider) { // Add AuthCache to the execution context HttpClientContext localContext = HttpClientContext.create(); return httpContext(localContext, authCache, provider); }
public static void withAuth(String urlStr, AuthSetup auth, Consumer<RDFConnection> action) { CredentialsProvider credsProvider = credsProvider(auth); HttpHost target = new HttpHost(auth.host, auth.port, "http"); // --- AuthCache : not necessary // Create AuthCache instance - necessary for non-repeatable request entity. (i.e. streaming) // [AuthScheme] AuthCache authCache = new BasicAuthCache(); if ( LibSec.authMode == AuthScheme.BASIC ) { RFC2617Scheme authScheme = authScheme(auth.realm); // Can force the client to use basic first time by setting authCache. // This does not work for digest because the nonce's will be wrong. authCache.put(target, authScheme); } HttpContext httpContext = httpContext(authCache, credsProvider); HttpClient httpClient = httpClient(auth); // Needs retryable mods to RDFConnectionRemote?? try ( RDFConnection conn = RDFConnectionRemote.create() .destination(urlStr) .httpClient(httpClient) .httpContext(httpContext) .build() ) { action.accept(conn); } }
public static void withAuth(String urlStr, AuthSetup auth, Consumer<RDFConnection> action) { CredentialsProvider credsProvider = credsProvider(auth); HttpHost target = new HttpHost(auth.host, auth.port, "http"); // --- AuthCache : not necessary // Create AuthCache instance - necessary for non-repeatable request entity. (i.e. streaming) // [AuthScheme] AuthCache authCache = new BasicAuthCache(); if ( LibSec.authMode == AuthScheme.BASIC ) { RFC2617Scheme authScheme = authScheme(auth.realm); // Can force the client to use basic first time by setting authCache. // This does not work for digest because the nonce's will be wrong. authCache.put(target, authScheme); } HttpContext httpContext = httpContext(authCache, credsProvider); HttpClient httpClient = httpClient(auth); // Needs retryable mods to RDFConnectionRemote?? try ( RDFConnection conn = RDFConnectionRemote.create() .destination(urlStr) .httpClient(httpClient) .httpContext(httpContext) .build() ) { action.accept(conn); } }