Example usage for org.apache.http.impl.auth SPNegoScheme SPNegoScheme

List of usage examples for org.apache.http.impl.auth SPNegoScheme SPNegoScheme

Introduction

In this page you can find the example usage for org.apache.http.impl.auth SPNegoScheme SPNegoScheme.

Prototype

public SPNegoScheme(final boolean stripPort) 

Source Link

Usage

From source file:eu.agno3.util.httpclient41.spnego.PreemptiveNegotiateAuthCache.java

@Override
public AuthScheme get(HttpHost host) {
    if (this.targetHost != null && this.targetHost.equals(host)) {
        AuthScheme scheme = new SPNegoScheme(this.stripPort);
        try {//from   w  ww .  j a v a2 s  . c  o m
            scheme.processChallenge(new BasicHeader("WWW-Authenticate", "Negotiate")); //$NON-NLS-1$//$NON-NLS-2$
        } catch (MalformedChallengeException e) {
            log.warn("Failed to process fake initial challenge:", e); //$NON-NLS-1$
        }
        log.debug("Returning PerRequestNegotiateScheme for host"); //$NON-NLS-1$
        return scheme;
    } else if (this.proxyHost != null && this.proxyHost.equals(host)) {
        AuthScheme scheme = new SPNegoScheme(this.stripPort);
        try {
            scheme.processChallenge(new BasicHeader("Proxy-Authenticate", "Negotiate")); //$NON-NLS-1$//$NON-NLS-2$
        } catch (MalformedChallengeException e) {
            log.warn("Failed to process fake initial challenge:", e); //$NON-NLS-1$
        }
        return scheme;
    }

    return super.get(host);
}