Skip to content

Commit 62da332

Browse files
author
Stephane Landelle
committed
...
1 parent 85ace54 commit 62da332

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
<groupId>ch.qos.logback</groupId>
116116
<artifactId>logback-classic</artifactId>
117117
<version>1.1.2</version>
118-
<scope>test</scope>
119118
</dependency>
120119
<dependency>
121120
<groupId>log4j</groupId>

src/main/java/ntlm/Ntlm.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package ntlm;
22

3+
import org.jboss.netty.logging.InternalLoggerFactory;
4+
import org.jboss.netty.logging.Slf4JLoggerFactory;
5+
36
import com.ning.http.client.AsyncHttpClient;
47
import com.ning.http.client.AsyncHttpClientConfig;
58
import com.ning.http.client.Realm;
6-
import com.ning.http.client.Response;
79
import com.ning.http.client.Realm.AuthScheme;
10+
import com.ning.http.client.Response;
811
import com.ning.http.client.providers.jdk.JDKAsyncHttpProvider;
912

1013
import java.io.IOException;
@@ -14,22 +17,24 @@ public class Ntlm {
1417

1518
public static void main(String[] args) throws InterruptedException, ExecutionException, IOException {
1619

20+
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
21+
1722
Realm realm = new Realm.RealmBuilder()//
1823
.setPrincipal("corpsignon")//
1924
.setPassword("Tester$1234")//
2025
.setUsePreemptiveAuth(true)//
21-
.setNtlmDomain("SIGNONTESTER.CORP.ORG")
22-
.setNtlmHost("NTLMTESTER")//
26+
.setNtlmDomain("signontester.corp.org")
27+
.setNtlmHost("ntlmtester")//
2328
.setScheme(AuthScheme.NTLM).build();
2429

2530
AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder().setRealm(realm);
2631

27-
AsyncHttpClient client = new AsyncHttpClient(JDKAsyncHttpProvider.class.getName(), builder.build());
32+
AsyncHttpClient client = new AsyncHttpClient(builder.build());
2833

2934
try {
3035
Response response = client.prepareGet("http://localhost:8080").execute().get();
3136

32-
System.err.println(response.getStatusCode());
37+
System.out.println(response.getStatusCode());
3338
} finally {
3439
client.close();
3540
}

src/main/resources/logback.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<configuration>
2+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
3+
<layout class="ch.qos.logback.classic.PatternLayout">
4+
<Pattern>%d [%thread] %level %logger - %m%n</Pattern>
5+
</layout>
6+
</appender>
7+
8+
<root level="TRACE">
9+
<appender-ref ref="CONSOLE"/>
10+
</root>
11+
</configuration>

0 commit comments

Comments
 (0)