1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package org.apache.hc.client5.http.impl.auth;
29
30 import org.apache.hc.client5.http.auth.AuthChallenge;
31 import org.apache.hc.client5.http.auth.AuthScheme;
32 import org.apache.hc.client5.http.auth.ChallengeType;
33 import org.apache.hc.client5.http.auth.StandardAuthScheme;
34 import org.junit.jupiter.api.Assertions;
35 import org.junit.jupiter.api.Test;
36
37
38
39
40 @SuppressWarnings("deprecation")
41 class TestNTLMScheme {
42
43 @Test
44 void testNTLMAuthenticationEmptyProxyChallenge() throws Exception {
45 final AuthChallenge authChallenge = new AuthChallenge(ChallengeType.PROXY, StandardAuthScheme.NTLM);
46 final AuthScheme authScheme = new NTLMScheme();
47 authScheme.processChallenge(authChallenge, null);
48
49 Assertions.assertFalse(authScheme.isChallengeComplete(),
50 "Challenge with an empty value received from NTML proxy must not interrupt authentication process.");
51 Assertions.assertTrue(authScheme.toString().contains(NTLMScheme.State.CHALLENGE_RECEIVED.toString()),
52 "Challenge with an empty value received from NTML proxy must transit status of NTLMScheme to CHALLENGE_RECEIVED.");
53 }
54 }