Java 类org.apache.http.client.AuthenticationStrategy 实例源码

项目:lams    文件:HttpAuthenticator.java   
public boolean isAuthenticationRequested(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    if (authStrategy.isAuthenticationRequested(host, response, context)) {
        return true;
    } else {
        switch (authState.getState()) {
        case CHALLENGED:
        case HANDSHAKE:
            authState.setState(AuthProtocolState.SUCCESS);
            authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
            break;
        case SUCCESS:
            break;
        default:
            authState.setState(AuthProtocolState.UNCHALLENGED);
        }
        return false;
    }
}
项目:purecloud-iot    文件:HttpClientBuilder.java   
/**
 * Produces an instance of {@link ClientExecChain} to be used as a main exec.
 * <p>
 * Default implementation produces an instance of {@link MainClientExec}
 * </p>
 * <p>
 * For internal use.
 * </p>
 *
 * @since 4.4
 */
protected ClientExecChain createMainExec(
        final HttpRequestExecutor requestExec,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final HttpProcessor proxyHttpProcessor,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler)
{
    return new MainClientExec(
            requestExec,
            connManager,
            reuseStrategy,
            keepAliveStrategy,
            proxyHttpProcessor,
            targetAuthStrategy,
            proxyAuthStrategy,
            userTokenHandler);
}
项目:purecloud-iot    文件:TestHttpAuthenticator.java   
@Before
public void setUp() throws Exception {
    this.defltAuthStrategy = Mockito.mock(AuthenticationStrategy.class);
    this.authState = new AuthState();
    this.authScheme = Mockito.mock(ContextAwareAuthScheme.class);
    Mockito.when(this.authScheme.getSchemeName()).thenReturn("Basic");
    Mockito.when(this.authScheme.isComplete()).thenReturn(Boolean.TRUE);
    this.context = new BasicHttpContext();
    this.defaultHost = new HttpHost("localhost", 80);
    this.context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, this.defaultHost);
    this.credentials = Mockito.mock(Credentials.class);
    this.credentialsProvider = new BasicCredentialsProvider();
    this.credentialsProvider.setCredentials(AuthScope.ANY, this.credentials);
    this.context.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
    this.authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
        .register("basic", new BasicSchemeFactory())
        .register("digest", new DigestSchemeFactory())
        .register("ntlm", new NTLMSchemeFactory()).build();
    this.context.setAttribute(HttpClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
    this.authCache = Mockito.mock(AuthCache.class);
    this.context.setAttribute(HttpClientContext.AUTH_CACHE, this.authCache);
    this.httpAuthenticator = new HttpAuthenticator();
}
项目:lams    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized final AuthenticationStrategy getTargetAuthenticationStrategy() {
    if (targetAuthStrategy == null) {
        targetAuthStrategy = createTargetAuthenticationStrategy();
    }
    return targetAuthStrategy;
}
项目:lams    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized final AuthenticationStrategy getProxyAuthenticationStrategy() {
    if (proxyAuthStrategy == null) {
        proxyAuthStrategy = createProxyAuthenticationStrategy();
    }
    return proxyAuthStrategy;
}
项目:lams    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
protected RequestDirector createClientRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectStrategy redirectStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler,
        final HttpParams params) {
    return new DefaultRequestDirector(
            log,
            requestExec,
            conman,
            reustrat,
            kastrat,
            rouplan,
            httpProcessor,
            retryHandler,
            redirectStrategy,
            targetAuthStrategy,
            proxyAuthStrategy,
            userTokenHandler,
            params);
}
项目:remote-files-sync    文件:HttpAuthenticator.java   
public boolean isAuthenticationRequested(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthStateHC4 authState,
        final HttpContext context) {
    if (authStrategy.isAuthenticationRequested(host, response, context)) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Authentication required");
        }
        if (authState.getState() == AuthProtocolState.SUCCESS) {
            authStrategy.authFailed(host, authState.getAuthScheme(), context);
        }
        return true;
    } else {
        switch (authState.getState()) {
        case CHALLENGED:
        case HANDSHAKE:
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Authentication succeeded");
            }
            authState.setState(AuthProtocolState.SUCCESS);
            authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
            break;
        case SUCCESS:
            break;
        default:
            authState.setState(AuthProtocolState.UNCHALLENGED);
        }
        return false;
    }
}
项目:remote-files-sync    文件:MainClientExec.java   
public MainClientExec(
        final HttpRequestExecutor requestExecutor,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler) {
    Args.notNull(requestExecutor, "HTTP request executor");
    Args.notNull(connManager, "Client connection manager");
    Args.notNull(reuseStrategy, "Connection reuse strategy");
    Args.notNull(keepAliveStrategy, "Connection keep alive strategy");
    Args.notNull(targetAuthStrategy, "Target authentication strategy");
    Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
    Args.notNull(userTokenHandler, "User token handler");
    this.authenticator      = new HttpAuthenticator();
    this.proxyHttpProcessor = new ImmutableHttpProcessor(
            new RequestTargetHostHC4(), new RequestClientConnControl());
    this.routeDirector      = new BasicRouteDirector();
    this.requestExecutor    = requestExecutor;
    this.connManager        = connManager;
    this.reuseStrategy      = reuseStrategy;
    this.keepAliveStrategy  = keepAliveStrategy;
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy  = proxyAuthStrategy;
    this.userTokenHandler   = userTokenHandler;
}
项目:purecloud-iot    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized final AuthenticationStrategy getTargetAuthenticationStrategy() {
    if (targetAuthStrategy == null) {
        targetAuthStrategy = createTargetAuthenticationStrategy();
    }
    return targetAuthStrategy;
}
项目:purecloud-iot    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized final AuthenticationStrategy getProxyAuthenticationStrategy() {
    if (proxyAuthStrategy == null) {
        proxyAuthStrategy = createProxyAuthenticationStrategy();
    }
    return proxyAuthStrategy;
}
项目:purecloud-iot    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
protected RequestDirector createClientRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectStrategy redirectStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler,
        final HttpParams params) {
    return new DefaultRequestDirector(
            log,
            requestExec,
            conman,
            reustrat,
            kastrat,
            rouplan,
            httpProcessor,
            retryHandler,
            redirectStrategy,
            targetAuthStrategy,
            proxyAuthStrategy,
            userTokenHandler,
            params);
}
项目:purecloud-iot    文件:HttpAuthenticator.java   
public boolean authenticate (
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    return handleAuthChallenge(host, response, authStrategy, authState, context);
}
项目:purecloud-iot    文件:HttpAuthenticator.java   
public boolean isAuthenticationRequested(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    if (authStrategy.isAuthenticationRequested(host, response, context)) {
        this.log.debug("Authentication required");
        if (authState.getState() == AuthProtocolState.SUCCESS) {
            authStrategy.authFailed(host, authState.getAuthScheme(), context);
        }
        return true;
    } else {
        switch (authState.getState()) {
        case CHALLENGED:
        case HANDSHAKE:
            this.log.debug("Authentication succeeded");
            authState.setState(AuthProtocolState.SUCCESS);
            authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
            break;
        case SUCCESS:
            break;
        default:
            authState.setState(AuthProtocolState.UNCHALLENGED);
        }
        return false;
    }
}
项目:purecloud-iot    文件:MainClientExec.java   
/**
 * @since 4.4
 */
public MainClientExec(
        final HttpRequestExecutor requestExecutor,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final HttpProcessor proxyHttpProcessor,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler) {
    Args.notNull(requestExecutor, "HTTP request executor");
    Args.notNull(connManager, "Client connection manager");
    Args.notNull(reuseStrategy, "Connection reuse strategy");
    Args.notNull(keepAliveStrategy, "Connection keep alive strategy");
    Args.notNull(proxyHttpProcessor, "Proxy HTTP processor");
    Args.notNull(targetAuthStrategy, "Target authentication strategy");
    Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
    Args.notNull(userTokenHandler, "User token handler");
    this.authenticator      = new HttpAuthenticator();
    this.routeDirector      = new BasicRouteDirector();
    this.requestExecutor    = requestExecutor;
    this.connManager        = connManager;
    this.reuseStrategy      = reuseStrategy;
    this.keepAliveStrategy  = keepAliveStrategy;
    this.proxyHttpProcessor = proxyHttpProcessor;
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy  = proxyAuthStrategy;
    this.userTokenHandler   = userTokenHandler;
}
项目:purecloud-iot    文件:MainClientExec.java   
public MainClientExec(
        final HttpRequestExecutor requestExecutor,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler) {
    this(requestExecutor, connManager, reuseStrategy, keepAliveStrategy,
            new ImmutableHttpProcessor(new RequestTargetHost()),
            targetAuthStrategy, proxyAuthStrategy, userTokenHandler);
}
项目:Visit    文件:HttpAuthenticator.java   
public boolean isAuthenticationRequested(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthStateHC4 authState,
        final HttpContext context) {
    if (authStrategy.isAuthenticationRequested(host, response, context)) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Authentication required");
        }
        if (authState.getState() == AuthProtocolState.SUCCESS) {
            authStrategy.authFailed(host, authState.getAuthScheme(), context);
        }
        return true;
    } else {
        switch (authState.getState()) {
        case CHALLENGED:
        case HANDSHAKE:
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Authentication succeeded");
            }
            authState.setState(AuthProtocolState.SUCCESS);
            authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
            break;
        case SUCCESS:
            break;
        default:
            authState.setState(AuthProtocolState.UNCHALLENGED);
        }
        return false;
    }
}
项目:Visit    文件:MainClientExec.java   
public MainClientExec(
        final HttpRequestExecutor requestExecutor,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler) {
    Args.notNull(requestExecutor, "HTTP request executor");
    Args.notNull(connManager, "Client connection manager");
    Args.notNull(reuseStrategy, "Connection reuse strategy");
    Args.notNull(keepAliveStrategy, "Connection keep alive strategy");
    Args.notNull(targetAuthStrategy, "Target authentication strategy");
    Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
    Args.notNull(userTokenHandler, "User token handler");
    this.authenticator      = new HttpAuthenticator();
    this.proxyHttpProcessor = new ImmutableHttpProcessor(
            new RequestTargetHostHC4(), new RequestClientConnControl());
    this.routeDirector      = new BasicRouteDirector();
    this.requestExecutor    = requestExecutor;
    this.connManager        = connManager;
    this.reuseStrategy      = reuseStrategy;
    this.keepAliveStrategy  = keepAliveStrategy;
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy  = proxyAuthStrategy;
    this.userTokenHandler   = userTokenHandler;
}
项目:ews-java-api    文件:ExchangeServiceBase.java   
private void initializeHttpClient() {
  Registry<ConnectionSocketFactory> registry = createConnectionSocketFactoryRegistry();
  HttpClientConnectionManager httpConnectionManager = new BasicHttpClientConnectionManager(registry);
  AuthenticationStrategy authStrategy = new CookieProcessingTargetAuthenticationStrategy();

  httpClient = HttpClients.custom()
    .setConnectionManager(httpConnectionManager)
    .setTargetAuthenticationStrategy(authStrategy)
    .build();
}
项目:ews-java-api    文件:ExchangeServiceBase.java   
private void initializeHttpPoolingClient() {
  Registry<ConnectionSocketFactory> registry = createConnectionSocketFactoryRegistry();
  PoolingHttpClientConnectionManager httpConnectionManager = new PoolingHttpClientConnectionManager(registry);
  httpConnectionManager.setMaxTotal(maximumPoolingConnections);
  httpConnectionManager.setDefaultMaxPerRoute(maximumPoolingConnections);
  AuthenticationStrategy authStrategy = new CookieProcessingTargetAuthenticationStrategy();

  httpPoolingClient = HttpClients.custom()
      .setConnectionManager(httpConnectionManager)
      .setTargetAuthenticationStrategy(authStrategy)
      .build();
}
项目:ZTLib    文件:HttpAuthenticator.java   
public boolean isAuthenticationRequested(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthStateHC4 authState,
        final HttpContext context) {
    if (authStrategy.isAuthenticationRequested(host, response, context)) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Authentication required");
        }
        if (authState.getState() == AuthProtocolState.SUCCESS) {
            authStrategy.authFailed(host, authState.getAuthScheme(), context);
        }
        return true;
    } else {
        switch (authState.getState()) {
        case CHALLENGED:
        case HANDSHAKE:
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Authentication succeeded");
            }
            authState.setState(AuthProtocolState.SUCCESS);
            authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
            break;
        case SUCCESS:
            break;
        default:
            authState.setState(AuthProtocolState.UNCHALLENGED);
        }
        return false;
    }
}
项目:ZTLib    文件:MainClientExec.java   
public MainClientExec(
        final HttpRequestExecutor requestExecutor,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler) {
    Args.notNull(requestExecutor, "HTTP request executor");
    Args.notNull(connManager, "Client connection manager");
    Args.notNull(reuseStrategy, "Connection reuse strategy");
    Args.notNull(keepAliveStrategy, "Connection keep alive strategy");
    Args.notNull(targetAuthStrategy, "Target authentication strategy");
    Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
    Args.notNull(userTokenHandler, "User token handler");
    this.authenticator      = new HttpAuthenticator();
    this.proxyHttpProcessor = new ImmutableHttpProcessor(
            new RequestTargetHostHC4(), new RequestClientConnControl());
    this.routeDirector      = new BasicRouteDirector();
    this.requestExecutor    = requestExecutor;
    this.connManager        = connManager;
    this.reuseStrategy      = reuseStrategy;
    this.keepAliveStrategy  = keepAliveStrategy;
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy  = proxyAuthStrategy;
    this.userTokenHandler   = userTokenHandler;
}
项目:BigSemanticsJava    文件:RedirectHttpClient.java   
@Override
protected RequestDirector createClientRequestDirector(HttpRequestExecutor requestExec,
                                                      ClientConnectionManager conman,
                                                      ConnectionReuseStrategy reustrat,
                                                      ConnectionKeepAliveStrategy kastrat,
                                                      HttpRoutePlanner rouplan,
                                                      HttpProcessor httpProcessor,
                                                      HttpRequestRetryHandler retryHandler,
                                                      RedirectStrategy redirectStrategy,
                                                      AuthenticationStrategy targetAuthStrategy,
                                                      AuthenticationStrategy proxyAuthStrategy,
                                                      UserTokenHandler userTokenHandler,
                                                      HttpParams params)
{
  return new RedirectRequestDirector(log,
                                     requestExec,
                                     conman,
                                     reustrat,
                                     kastrat,
                                     rouplan,
                                     httpProcessor,
                                     retryHandler,
                                     redirectStrategy,
                                     targetAuthStrategy,
                                     proxyAuthStrategy,
                                     userTokenHandler,
                                     params);
}
项目:BigSemanticsJava    文件:RedirectRequestDirector.java   
public RedirectRequestDirector(Log log,
                               HttpRequestExecutor requestExec,
                               ClientConnectionManager conman,
                               ConnectionReuseStrategy reustrat,
                               ConnectionKeepAliveStrategy kastrat,
                               HttpRoutePlanner rouplan,
                               HttpProcessor httpProcessor,
                               HttpRequestRetryHandler retryHandler,
                               RedirectStrategy redirectStrategy,
                               AuthenticationStrategy targetAuthStrategy,
                               AuthenticationStrategy proxyAuthStrategy,
                               UserTokenHandler userTokenHandler,
                               HttpParams params)
{
  super(log,
        requestExec,
        conman,
        reustrat,
        kastrat,
        rouplan,
        httpProcessor,
        retryHandler,
        redirectStrategy,
        targetAuthStrategy,
        proxyAuthStrategy,
        userTokenHandler,
        params);
}
项目:springboot-shiro-cas-mybatis    文件:SimpleHttpClientFactoryBean.java   
public AuthenticationStrategy getProxyAuthenticationStrategy() {
    return this.proxyAuthenticationStrategy;
}
项目:springboot-shiro-cas-mybatis    文件:SimpleHttpClientFactoryBean.java   
public void setProxyAuthenticationStrategy(final AuthenticationStrategy proxyAuthenticationStrategy) {
    this.proxyAuthenticationStrategy = proxyAuthenticationStrategy;
}
项目:springboot-shiro-cas-mybatis    文件:SimpleHttpClientFactoryBean.java   
public AuthenticationStrategy getProxyAuthenticationStrategy() {
    return this.proxyAuthenticationStrategy;
}
项目:springboot-shiro-cas-mybatis    文件:SimpleHttpClientFactoryBean.java   
public void setProxyAuthenticationStrategy(final AuthenticationStrategy proxyAuthenticationStrategy) {
    this.proxyAuthenticationStrategy = proxyAuthenticationStrategy;
}
项目:cas-5.1.0    文件:SimpleHttpClientFactoryBean.java   
public AuthenticationStrategy getProxyAuthenticationStrategy() {
    return this.proxyAuthenticationStrategy;
}
项目:cas-5.1.0    文件:SimpleHttpClientFactoryBean.java   
public void setProxyAuthenticationStrategy(final AuthenticationStrategy proxyAuthenticationStrategy) {
    this.proxyAuthenticationStrategy = proxyAuthenticationStrategy;
}
项目:cas-server-4.2.1    文件:SimpleHttpClientFactoryBean.java   
public AuthenticationStrategy getProxyAuthenticationStrategy() {
    return this.proxyAuthenticationStrategy;
}
项目:cas-server-4.2.1    文件:SimpleHttpClientFactoryBean.java   
public void setProxyAuthenticationStrategy(final AuthenticationStrategy proxyAuthenticationStrategy) {
    this.proxyAuthenticationStrategy = proxyAuthenticationStrategy;
}
项目:lams    文件:AbstractHttpClient.java   
protected AuthenticationStrategy createTargetAuthenticationStrategy() {
    return new TargetAuthenticationStrategy();
}
项目:lams    文件:AbstractHttpClient.java   
protected AuthenticationStrategy createProxyAuthenticationStrategy() {
    return new ProxyAuthenticationStrategy();
}
项目:lams    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized void setTargetAuthenticationStrategy(final AuthenticationStrategy strategy) {
    this.targetAuthStrategy = strategy;
}
项目:lams    文件:AbstractHttpClient.java   
/**
 * @since 4.2
 */
public synchronized void setProxyAuthenticationStrategy(final AuthenticationStrategy strategy) {
    this.proxyAuthStrategy = strategy;
}
项目:lams    文件:HttpAuthenticator.java   
public boolean authenticate(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    try {
        if (this.log.isDebugEnabled()) {
            this.log.debug(host.toHostString() + " requested authentication");
        }
        Map<String, Header> challenges = authStrategy.getChallenges(host, response, context);
        if (challenges.isEmpty()) {
            this.log.debug("Response contains no authentication challenges");
            return false;
        }

        AuthScheme authScheme = authState.getAuthScheme();
        switch (authState.getState()) {
        case FAILURE:
            return false;
        case SUCCESS:
            authState.reset();
            break;
        case CHALLENGED:
        case HANDSHAKE:
            if (authScheme == null) {
                this.log.debug("Auth scheme is null");
                authStrategy.authFailed(host, null, context);
                authState.reset();
                authState.setState(AuthProtocolState.FAILURE);
                return false;
            }
        case UNCHALLENGED:
            if (authScheme != null) {
                String id = authScheme.getSchemeName();
                Header challenge = challenges.get(id.toLowerCase(Locale.US));
                if (challenge != null) {
                    this.log.debug("Authorization challenge processed");
                    authScheme.processChallenge(challenge);
                    if (authScheme.isComplete()) {
                        this.log.debug("Authentication failed");
                        authStrategy.authFailed(host, authState.getAuthScheme(), context);
                        authState.reset();
                        authState.setState(AuthProtocolState.FAILURE);
                        return false;
                    } else {
                        authState.setState(AuthProtocolState.HANDSHAKE);
                        return true;
                    }
                } else {
                    authState.reset();
                    // Retry authentication with a different scheme
                }
            }
        }
        Queue<AuthOption> authOptions = authStrategy.select(challenges, host, response, context);
        if (authOptions != null && !authOptions.isEmpty()) {
            if (this.log.isDebugEnabled()) {
                this.log.debug("Selected authentication options: " + authOptions);
            }
            authState.setState(AuthProtocolState.CHALLENGED);
            authState.update(authOptions);
            return true;
        } else {
            return false;
        }
    } catch (MalformedChallengeException ex) {
        if (this.log.isWarnEnabled()) {
            this.log.warn("Malformed challenge: " +  ex.getMessage());
        }
        authState.reset();
        return false;
    }
}
项目:remote-files-sync    文件:HttpClientBuilder.java   
/**
 * Assigns {@link AuthenticationStrategy} instance for proxy
 * authentication.
 */
public final HttpClientBuilder setTargetAuthenticationStrategy(
        final AuthenticationStrategy targetAuthStrategy) {
    this.targetAuthStrategy = targetAuthStrategy;
    return this;
}
项目:remote-files-sync    文件:HttpClientBuilder.java   
/**
 * Assigns {@link AuthenticationStrategy} instance for target
 * host authentication.
 */
public final HttpClientBuilder setProxyAuthenticationStrategy(
        final AuthenticationStrategy proxyAuthStrategy) {
    this.proxyAuthStrategy = proxyAuthStrategy;
    return this;
}
项目:cas4.1.9    文件:SimpleHttpClientFactoryBean.java   
public AuthenticationStrategy getProxyAuthenticationStrategy() {
    return this.proxyAuthenticationStrategy;
}
项目:cas4.1.9    文件:SimpleHttpClientFactoryBean.java   
public void setProxyAuthenticationStrategy(final AuthenticationStrategy proxyAuthenticationStrategy) {
    this.proxyAuthenticationStrategy = proxyAuthenticationStrategy;
}