protected PasswordAuthentication getPasswordAuthentication() { if (hasProxy && getRequestingHost().equals(proxyServer.getHost()) && getRequestingPort() == proxyServer.getPort()) { String password = ""; if (proxyServer.getPassword() != null) { password = proxyServer.getPassword(); } return new PasswordAuthentication(proxyServer.getPrincipal(), password.toCharArray()); } if (hasAuthentication) { return new PasswordAuthentication(realm.getPrincipal(), realm.getPassword().toCharArray()); } return super.getPasswordAuthentication(); } });
public static String computeBasicAuthentication(ProxyServer proxyServer) { return computeBasicAuthentication(proxyServer.getPrincipal(), proxyServer.getPassword(), proxyServer.getCharset()); }
public static String computeBasicAuthentication(ProxyServer proxyServer) throws UnsupportedEncodingException { String s = proxyServer.getPrincipal() + ":" + proxyServer.getPassword(); return "Basic " + Base64.encode(s.getBytes(proxyServer.getEncoding())); }
protected PasswordAuthentication getPasswordAuthentication() { if (hasProxy && getRequestingHost().equals(proxyServer.getHost()) && getRequestingPort() == proxyServer.getPort()) { String password = ""; if (proxyServer.getPassword() != null) { password = proxyServer.getPassword(); } return new PasswordAuthentication(proxyServer.getPrincipal(), password.toCharArray()); } if (hasAuthentication) { return new PasswordAuthentication(realm.getPrincipal(), realm.getPassword().toCharArray()); } return super.getPasswordAuthentication(); } });
public static String computeBasicAuthentication(ProxyServer proxyServer) { return computeBasicAuthentication(proxyServer.getPrincipal(), proxyServer.getPassword(), proxyServer.getCharset()); }
public static String computeBasicAuthentication(ProxyServer proxyServer) { return computeBasicAuthentication(proxyServer.getPrincipal(), proxyServer.getPassword(), proxyServer.getCharset()); }
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(); }
Credentials defaultcreds = new UsernamePasswordCredentials(proxyServer.getPrincipal(), proxyServer.getPassword()); client.getState().setProxyCredentials(new AuthScope(null, -1, AuthScope.ANY_REALM), defaultcreds);
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(); } }