Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: net/http/http_auth_handler_ntlm.h

Issue 2904633002: Replace NTLMv1 implementation with a functionally equivalent one.
Patch Set: Cleanup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 12
13 // This contains the portable and the SSPI implementations for NTLM. 13 // This contains the portable and the SSPI implementations for NTLM.
14 // We use NTLM_SSPI for Windows, and NTLM_PORTABLE for other platforms. 14 // We use NTLM_SSPI for Windows, and NTLM_PORTABLE for other platforms.
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 #define NTLM_SSPI 16 #define NTLM_SSPI
17 #else 17 #else
18 #define NTLM_PORTABLE 18 #define NTLM_PORTABLE
19 #endif 19 #endif
20 20
21 #if defined(NTLM_SSPI) 21 #if defined(NTLM_SSPI)
22 #define SECURITY_WIN32 1 22 #define SECURITY_WIN32 1
23 #include <windows.h> 23 #include <windows.h>
24 #include <security.h> 24 #include <security.h>
25 #include "net/http/http_auth_sspi_win.h" 25 #include "net/http/http_auth_sspi_win.h"
26 #elif defined(NTLM_PORTABLE)
27 #include "net/ntlm/ntlm_client.h"
26 #endif 28 #endif
27 29
28 #include <string> 30 #include <string>
29 31
30 #include "base/strings/string16.h" 32 #include "base/strings/string16.h"
31 #include "net/base/net_export.h" 33 #include "net/base/net_export.h"
32 #include "net/http/http_auth_handler.h" 34 #include "net/http/http_auth_handler.h"
33 #include "net/http/http_auth_handler_factory.h" 35 #include "net/http/http_auth_handler_factory.h"
34 36
35 namespace net { 37 namespace net {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); 137 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc);
136 static HostNameProc SetHostNameProc(HostNameProc proc); 138 static HostNameProc SetHostNameProc(HostNameProc proc);
137 #endif 139 #endif
138 140
139 // Parse the challenge, saving the results into this instance. 141 // Parse the challenge, saving the results into this instance.
140 HttpAuth::AuthorizationResult ParseChallenge( 142 HttpAuth::AuthorizationResult ParseChallenge(
141 HttpAuthChallengeTokenizer* tok, bool initial_challenge); 143 HttpAuthChallengeTokenizer* tok, bool initial_challenge);
142 144
143 // Given an input token received from the server, generate the next output 145 // Given an input token received from the server, generate the next output
144 // token to be sent to the server. 146 // token to be sent to the server.
145 int GetNextToken(const void* in_token, 147 ntlm::Buffer GetNextToken(const ntlm::Buffer& in_token);
146 uint32_t in_token_len,
147 void** out_token,
148 uint32_t* out_token_len);
149 148
150 // Create an NTLM SPN to identify the |origin| server. 149 // Create an NTLM SPN to identify the |origin| server.
151 static std::string CreateSPN(const GURL& origin); 150 static std::string CreateSPN(const GURL& origin);
152 151
153 #if defined(NTLM_SSPI) 152 #if defined(NTLM_SSPI)
154 HttpAuthSSPI auth_sspi_; 153 HttpAuthSSPI auth_sspi_;
154 #elif defined(NTLM_PORTABLE)
155 ntlm::NtlmClient ntlm_client_;
155 #endif 156 #endif
156 157
157 #if defined(NTLM_PORTABLE) 158 #if defined(NTLM_PORTABLE)
158 static GenerateRandomProc generate_random_proc_; 159 static GenerateRandomProc generate_random_proc_;
159 static HostNameProc get_host_name_proc_; 160 static HostNameProc get_host_name_proc_;
160 #endif 161 #endif
161 162
162 base::string16 domain_; 163 base::string16 domain_;
163 AuthCredentials credentials_; 164 AuthCredentials credentials_;
164 std::string channel_bindings_; 165 std::string channel_bindings_;
165 166
166 // The base64-encoded string following "NTLM" in the "WWW-Authenticate" or 167 // The base64-encoded string following "NTLM" in the "WWW-Authenticate" or
167 // "Proxy-Authenticate" response header. 168 // "Proxy-Authenticate" response header.
168 std::string auth_data_; 169 std::string auth_data_;
169 170
170 #if defined(NTLM_SSPI) 171 #if defined(NTLM_SSPI)
171 const HttpAuthPreferences* http_auth_preferences_; 172 const HttpAuthPreferences* http_auth_preferences_;
172 #endif 173 #endif
173 }; 174 };
174 175
175 } // namespace net 176 } // namespace net
176 177
177 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ 178 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698