public Executor auth(final AuthScope authScope, final Credentials creds) { if (this.credentialsStore == null) { this.credentialsStore = new BasicCredentialsProvider(); } this.credentialsStore.setCredentials(authScope, creds); return this; }
public Executor clearAuth() { if (this.credentialsStore != null) { this.credentialsStore.clear(); } return this; }
public Executor authPreemptive(final HttpHost host) { if (this.credentialsStore != null) { final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(host), null); if (credentials == null) { final BasicScheme basicScheme = new BasicScheme(); basicScheme.initPreemptive(credentials); this.authCache.put(host, basicScheme); } } return this; }
public Executor authPreemptiveProxy(final HttpHost proxy) { if (this.credentialsStore != null) { final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(proxy), null); if (credentials == null) { final BasicScheme basicScheme = new BasicScheme(); basicScheme.initPreemptive(credentials); this.authCache.put(proxy, basicScheme); } } return this; }
public Executor auth(final AuthScope authScope, final Credentials creds) { if (this.credentialsStore == null) { this.credentialsStore = new BasicCredentialsProvider(); } this.credentialsStore.setCredentials(authScope, creds); return this; }
public Executor authPreemptive(final HttpHost host) { if (this.credentialsStore != null) { final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(host), null); if (credentials == null) { final BasicScheme basicScheme = new BasicScheme(); basicScheme.initPreemptive(credentials); this.authCache.put(host, basicScheme); } } return this; }
public Executor clearAuth() { if (this.credentialsStore != null) { this.credentialsStore.clear(); } return this; }
public static void extractFromAuthority( final String scheme, final URIAuthority authority, final CredentialsStore credentialsStore) { Args.notNull(credentialsStore, "Credentials store"); if (authority == null) { return; } final String userinfo = authority.getUserInfo(); if (userinfo == null) { return; } final int atColon = userinfo.indexOf(':'); final String userName; final char[] password; if (atColon >= 0) { userName = userinfo.substring(0, atColon); password = userinfo.substring(atColon + 1).toCharArray(); } else { userName = userinfo.substring(0, atColon); password = null; } credentialsStore.setCredentials( new AuthScope(scheme, authority.getHostName(), authority.getPort(), null, AuthSchemes.BASIC.ident), new UsernamePasswordCredentials(userName, password)); }
public Executor authPreemptiveProxy(final HttpHost proxy) { if (this.credentialsStore != null) { final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(proxy), null); if (credentials == null) { final BasicScheme basicScheme = new BasicScheme(); basicScheme.initPreemptive(credentials); this.authCache.put(proxy, basicScheme); } } return this; }