equal
deleted
inserted
replaced
24 */ |
24 */ |
25 |
25 |
26 package sun.net.www.protocol.http.ntlm; |
26 package sun.net.www.protocol.http.ntlm; |
27 |
27 |
28 import java.io.IOException; |
28 import java.io.IOException; |
29 import sun.misc.BASE64Encoder; |
29 import java.util.Base64; |
30 import sun.misc.BASE64Decoder; |
|
31 |
30 |
32 /* |
31 /* |
33 * Hooks into Windows implementation of NTLM. |
32 * Hooks into Windows implementation of NTLM. |
34 * This class will be replaced if a cross-platform version of NTLM |
33 * This class will be replaced if a cross-platform version of NTLM |
35 * is implemented in the future. |
34 * is implemented in the future. |
75 byte[] input = null; |
74 byte[] input = null; |
76 |
75 |
77 assert !status.sequenceComplete; |
76 assert !status.sequenceComplete; |
78 |
77 |
79 if (token != null) |
78 if (token != null) |
80 input = (new BASE64Decoder()).decodeBuffer(token); |
79 input = Base64.getDecoder().decode(token); |
81 byte[] b = getNextToken (crdHandle, input, status); |
80 byte[] b = getNextToken (crdHandle, input, status); |
82 if (b == null) |
81 if (b == null) |
83 throw new IOException ("Internal authentication error"); |
82 throw new IOException ("Internal authentication error"); |
84 return (new B64Encoder()).encode (b); |
83 return Base64.getEncoder().encodeToString(b); |
85 } |
84 } |
86 |
85 |
87 public boolean isComplete() { |
86 public boolean isComplete() { |
88 return status.sequenceComplete; |
87 return status.sequenceComplete; |
89 } |
88 } |
93 private native long getCredentialsHandle (String user, String domain, String password); |
92 private native long getCredentialsHandle (String user, String domain, String password); |
94 |
93 |
95 private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned); |
94 private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned); |
96 } |
95 } |
97 |
96 |
98 class B64Encoder extends BASE64Encoder { |
|
99 protected int bytesPerLine () { |
|
100 return 1024; |
|
101 } |
|
102 } |
|