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 auth(final HttpHost host, final String username, final char[] password, final String workstation, final String domain) { return auth(host, new NTCredentials(username, password, workstation, domain)); }
public static KerberosConfig.Builder copy(final KerberosConfig config) { return new Builder() .setStripPort(config.getStripPort()) .setUseCanonicalHostname(config.getUseCanonicalHostname()) .setRequestDelegCreds(config.getRequestDelegCreds()); }
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); if (authChallenge.getValue() == null) { throw new MalformedChallengeException("Missing auth challenge"); } challengeType = authChallenge.getChallengeType(); challenge = authChallenge.getValue(); if (challenge.isEmpty()) { if (clientCred != null) { dispose(); // run cleanup first before throwing an exception otherwise can leak OS resources if (continueNeeded) { throw new IllegalStateException("Unexpected token"); } } } }
private static Principal getAuthPrincipal(final AuthExchange authExchange) { final AuthScheme scheme = authExchange.getAuthScheme(); if (scheme != null && scheme.isConnectionBased()) { return scheme.getPrincipal(); } return null; }
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 auth(final HttpHost host, final String username, final char[] password) { return auth(host, new UsernamePasswordCredentials(username, password)); }
@Override public Principal getPrincipal() { return new BasicUserPrincipal(getCurrentUsername()); }
public Executor auth(final HttpHost host, final Credentials creds) { return auth(new AuthScope(host), creds); }
failAuthCleanup(); if (ex instanceof Win32Exception) { throw new AuthenticationException("Authentication Failed", ex); throw new AuthenticationException("Authentication Failed"); } else { try { failAuthCleanup(); if (ex instanceof Win32Exception) { throw new AuthenticationException("Authentication Failed", ex);
/** * Returns {@code true} if the actual authentication scheme is connection based. */ public boolean isConnectionBased() { return this.authScheme != null && this.authScheme.isConnectionBased(); }
/** * Retrieves the name to authenticate with. * * @return String the domain these credentials are intended to authenticate with. */ public String getDomain() { return this.principal.getDomain(); }
public KerberosConfig build() { return new KerberosConfig( stripPort, useCanonicalHostname, requestDelegCreds); }
@Override public String toString() { return this.principal.toString(); }
@Override public Principal getPrincipal() { return this.credentials != null ? this.credentials.getUserPrincipal() : null; }
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 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; }