System.setProperty(NTLM_DOMAIN, proxyServer.getNtlmDomain());
public static String perConnectionProxyAuthorizationHeader( Request request, ProxyServer proxyServer, boolean connect) throws IOException { String proxyAuthorization = null; if (connect) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); String ntlmHeader = getNTLM(auth); if (ntlmHeader != null) { proxyAuthorization = ntlmHeader; } } else if (proxyServer != null && proxyServer.getPrincipal() != null && isNonEmpty(proxyServer.getNtlmDomain())) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); if (getNTLM(auth) == null) { String msg = NTLMEngine.INSTANCE.generateType1Msg(); proxyAuthorization = "NTLM " + msg; } } return proxyAuthorization; }
private String proxyAuthorizationHeader(Request request, ProxyServer proxyServer, HttpMethod method) throws IOException { String proxyAuthorization = null; if (method == HttpMethod.CONNECT) { List<String> auth = request.getHeaders().get(HttpHeaders.Names.PROXY_AUTHORIZATION); if (isNTLM(auth)) { proxyAuthorization = auth.get(0); } } else if (proxyServer != null && proxyServer.getPrincipal() != null) { if (isNonEmpty(proxyServer.getNtlmDomain())) { List<String> auth = request.getHeaders().get(HttpHeaders.Names.PROXY_AUTHORIZATION); if (!isNTLM(auth)) { try { String msg = NTLMEngine.INSTANCE.generateType1Msg(proxyServer.getNtlmDomain(), proxyServer.getHost()); proxyAuthorization = "NTLM " + msg; } catch (NTLMEngineException e) { IOException ie = new IOException(); ie.initCause(e); throw ie; } } } else { proxyAuthorization = computeBasicAuthentication(proxyServer); } } return proxyAuthorization; }
System.setProperty(NTLM_DOMAIN, proxyServer.getNtlmDomain());
case NTLM: String domain; if (proxyServer != null && proxyServer.getNtlmDomain() != null) { domain = proxyServer.getNtlmDomain(); } else { domain = realm.getNtlmDomain();
private Realm ntlmProxyChallenge(List<String> wwwAuth, Request request, ProxyServer proxyServer, FluentCaseInsensitiveStringsMap headers, Realm realm, NettyResponseFuture<?> future, boolean proxyInd) throws NTLMEngineException { future.getAndSetAuth(false); headers.remove(HttpHeaders.Names.PROXY_AUTHORIZATION); addType3NTLMAuthorizationHeader(wwwAuth, headers, proxyServer.getPrincipal(), proxyServer.getPassword(), proxyServer.getNtlmDomain(), proxyServer.getHost(), proxyInd); return newRealmBuilder(realm)// // .setScheme(realm.getAuthScheme()) .setUri(request.getURI())// .setMethodName(request.getMethod()).build(); }
public static String perConnectionProxyAuthorizationHeader( Request request, ProxyServer proxyServer, boolean connect) throws IOException { String proxyAuthorization = null; if (connect) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); String ntlmHeader = getNTLM(auth); if (ntlmHeader != null) { proxyAuthorization = ntlmHeader; } else { String msg = NTLMEngine.INSTANCE.generateType1Msg(); proxyAuthorization = "NTLM " + msg; } } else if (proxyServer != null && proxyServer.getPrincipal() != null && isNonEmpty(proxyServer.getNtlmDomain())) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); if (getNTLM(auth) == null) { String msg = NTLMEngine.INSTANCE.generateType1Msg(); proxyAuthorization = "NTLM " + msg; } } return proxyAuthorization; }
public static String perConnectionProxyAuthorizationHeader( Request request, ProxyServer proxyServer, boolean connect) throws IOException { String proxyAuthorization = null; if (connect) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); String ntlmHeader = getNTLM(auth); if (ntlmHeader != null) { proxyAuthorization = ntlmHeader; } else { String msg = NTLMEngine.INSTANCE.generateType1Msg(); proxyAuthorization = "NTLM " + msg; } } else if (proxyServer != null && proxyServer.getPrincipal() != null && isNonEmpty(proxyServer.getNtlmDomain())) { List<String> auth = request.getHeaders().get(PROXY_AUTH_HEADER); if (getNTLM(auth) == null) { String msg = NTLMEngine.INSTANCE.generateType1Msg(); proxyAuthorization = "NTLM " + msg; } } return proxyAuthorization; }
private Realm ntlmChallenge(List<String> wwwAuth, Request request, ProxyServer proxyServer, FluentCaseInsensitiveStringsMap headers, Realm realm, NettyResponseFuture<?> future, boolean proxyInd) throws NTLMEngineException { boolean useRealm = proxyServer == null && realm != null; String ntlmDomain = useRealm ? realm.getNtlmDomain() : proxyServer.getNtlmDomain(); String ntlmHost = useRealm ? realm.getNtlmHost() : proxyServer.getHost(); String principal = useRealm ? realm.getPrincipal() : proxyServer.getPrincipal(); String password = useRealm ? realm.getPassword() : proxyServer.getPassword(); UriComponents uri = request.getURI(); if (realm != null && !realm.isNtlmMessageType2Received()) { String challengeHeader = NTLMEngine.INSTANCE.generateType1Msg(ntlmDomain, ntlmHost); addNTLMAuthorizationHeader(headers, challengeHeader, proxyInd); future.getAndSetAuth(false); return newRealmBuilder(realm)// .setScheme(realm.getAuthScheme())// .setUri(uri)// .setMethodName(request.getMethod())// .setNtlmMessageType2Received(true)// .build(); } else { addType3NTLMAuthorizationHeader(wwwAuth, headers, principal, password, ntlmDomain, ntlmHost, proxyInd); Realm.AuthScheme authScheme = realm != null ? realm.getAuthScheme() : Realm.AuthScheme.NTLM; return newRealmBuilder(realm)// .setScheme(authScheme)// .setUri(uri)// .setMethodName(request.getMethod())// .build(); } }