Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9271cf

Browse files
committed
Improve NTLM support by supporting JDK property
1 parent42ea80d commite9271cf

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

‎src/main/java/com/ning/http/client/Realm.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
*/
1717
packagecom.ning.http.client;
1818

19+
importorg.slf4j.Logger;
20+
importorg.slf4j.LoggerFactory;
21+
1922
importjava.io.UnsupportedEncodingException;
2023
importjava.security.MessageDigest;
2124
importjava.security.NoSuchAlgorithmException;
@@ -243,6 +246,8 @@ public int hashCode() {
243246
*/
244247
publicstaticclassRealmBuilder {
245248

249+
privatestaticfinalLoggerlogger =LoggerFactory.getLogger(RealmBuilder.class);
250+
246251
//
247252
// Portions of code (newCnonce, newResponse) are highly inspired be Jetty 6 BasicAuthentication.java class.
248253
// This code is already Apache licenced.
@@ -555,6 +560,14 @@ public Realm build() {
555560
}
556561
}
557562

563+
if (scheme.equals(AuthScheme.NTLM) &&domain.equalsIgnoreCase("")){
564+
logger.info("NTLM domain is not set, trying to read it from system property -Dhttp.auth.ntlm.domain");
565+
Stringtmp =System.getProperty("http.auth.ntlm.domain");
566+
if (tmp !=null) {
567+
domain =tmp;
568+
}
569+
}
570+
558571
returnnewRealm(scheme,
559572
principal,
560573
password,

‎src/main/java/com/ning/http/client/providers/jdk/JDKAsyncHttpProvider.java‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,14 @@ private void configure(URI uri, HttpURLConnection urlConnection, Request request
499499

500500
if (proxyServer.getProtocol().equals(ProxyServer.Protocol.NTLM)) {
501501

502-
if (proxyServer.getNtlmDomain() ==null)thrownewIllegalStateException("NTLM Domain cannot be null");
503-
504502
jdkNtlmDomain =System.getProperty(NTLM_DOMAIN);
503+
if (proxyServer.getNtlmDomain() ==null) {
504+
logger.info("NTLM domain is not set, trying to read it from system property -D{}",NTLM_DOMAIN);
505+
if (jdkNtlmDomain !=null) {
506+
proxyServer.setNtlmDomain(jdkNtlmDomain);
507+
}
508+
}
509+
505510
System.setProperty(NTLM_DOMAIN,proxyServer.getNtlmDomain());
506511
}
507512
}
@@ -525,7 +530,11 @@ private void configure(URI uri, HttpURLConnection urlConnection, Request request
525530
break;
526531
caseNTLM:
527532
jdkNtlmDomain =System.getProperty(NTLM_DOMAIN);
528-
System.setProperty(NTLM_DOMAIN,realm.getDomain());
533+
if (realm.getNtlmDomain() ==null) {
534+
logger.info("NTLM domain is not set, trying to read it from system property -D{}",NTLM_DOMAIN);
535+
}else {
536+
System.setProperty(NTLM_DOMAIN,realm.getNtlmDomain());
537+
}
529538
break;
530539
default:
531540
thrownewIllegalStateException(String.format("Invalid Authentication %s",realm.toString()));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp