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

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

Issue 1535019: Kerberos SPN generation for Negotiate challenges (Closed)
Patch Set: Fix to GetCanonicalName that is another CL. Created 10 years, 8 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
« no previous file with comments | « net/http/http_auth_handler_ntlm.h ('k') | net/http/http_auth_handler_ntlm_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/http/http_auth_handler_ntlm.h" 5 #include "net/http/http_auth_handler_ntlm.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/net_util.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 int HttpAuthHandlerNTLM::GenerateAuthToken( 16 int HttpAuthHandlerNTLM::GenerateAuthToken(
16 const std::wstring& username, 17 const std::wstring& username,
17 const std::wstring& password, 18 const std::wstring& password,
18 const HttpRequestInfo* request, 19 const HttpRequestInfo* request,
19 const ProxyInfo* proxy, 20 const ProxyInfo* proxy,
20 std::string* auth_token) { 21 std::string* auth_token) {
21 #if defined(NTLM_SSPI) 22 #if defined(NTLM_SSPI)
22 return auth_sspi_.GenerateAuthToken( 23 return auth_sspi_.GenerateAuthToken(
23 &username, 24 &username,
24 &password, 25 &password,
25 origin_, 26 CreateSPN(origin_),
26 request, 27 request,
27 proxy, 28 proxy,
28 auth_token); 29 auth_token);
29 #else // !defined(NTLM_SSPI) 30 #else // !defined(NTLM_SSPI)
30 // TODO(wtc): See if we can use char* instead of void* for in_buf and 31 // TODO(wtc): See if we can use char* instead of void* for in_buf and
31 // out_buf. This change will need to propagate to GetNextToken, 32 // out_buf. This change will need to propagate to GetNextToken,
32 // GenerateType1Msg, and GenerateType3Msg, and perhaps further. 33 // GenerateType1Msg, and GenerateType3Msg, and perhaps further.
33 const void* in_buf; 34 const void* in_buf;
34 void* out_buf; 35 void* out_buf;
35 uint32 in_buf_len, out_buf_len; 36 uint32 in_buf_len, out_buf_len;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!tok->valid() || !LowerCaseEqualsASCII(tok->scheme(), "ntlm")) 103 if (!tok->valid() || !LowerCaseEqualsASCII(tok->scheme(), "ntlm"))
103 return false; 104 return false;
104 105
105 tok->set_expect_base64_token(true); 106 tok->set_expect_base64_token(true);
106 if (tok->GetNext()) 107 if (tok->GetNext())
107 auth_data_.assign(tok->value_begin(), tok->value_end()); 108 auth_data_.assign(tok->value_begin(), tok->value_end());
108 return true; 109 return true;
109 #endif // defined(NTLM_SSPI) 110 #endif // defined(NTLM_SSPI)
110 } 111 }
111 112
113 // static
114 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) {
115 // The service principal name of the destination server. See
116 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx
117 std::wstring target(L"HTTP/");
118 target.append(ASCIIToWide(GetHostAndPort(origin)));
119 return target;
120 }
121
112 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_ntlm.h ('k') | net/http/http_auth_handler_ntlm_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698