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

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

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 years 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 | Annotate | Revision Log
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 #include "net/http/http_auth_handler_ntlm.h" 5 #include "net/http/http_auth_handler_ntlm.h"
6 6
7 #if !defined(NTLM_SSPI) 7 #if !defined(NTLM_SSPI)
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #endif 9 #endif
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 22
23 bool HttpAuthHandlerNTLM::Init(HttpAuth::ChallengeTokenizer* tok) { 23 bool HttpAuthHandlerNTLM::Init(HttpAuth::ChallengeTokenizer* tok) {
24 auth_scheme_ = HttpAuth::AUTH_SCHEME_NTLM; 24 auth_scheme_ = HttpAuth::AUTH_SCHEME_NTLM;
25 score_ = 3; 25 score_ = 3;
26 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; 26 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED;
27 27
28 return ParseChallenge(tok, true) == HttpAuth::AUTHORIZATION_RESULT_ACCEPT; 28 return ParseChallenge(tok, true) == HttpAuth::AUTHORIZATION_RESULT_ACCEPT;
29 } 29 }
30 30
31 int HttpAuthHandlerNTLM::GenerateAuthTokenImpl( 31 int HttpAuthHandlerNTLM::GenerateAuthTokenImpl(
32 const AuthCredentials* credentials, 32 const AuthCredentials* credentials, const HttpRequestInfo* request,
33 const HttpRequestInfo* request, 33 const CompletionCallback& callback, std::string* auth_token) {
34 OldCompletionCallback* callback,
35 std::string* auth_token) {
36 #if defined(NTLM_SSPI) 34 #if defined(NTLM_SSPI)
37 return auth_sspi_.GenerateAuthToken( 35 return auth_sspi_.GenerateAuthToken(
38 credentials, 36 credentials,
39 CreateSPN(origin_), 37 CreateSPN(origin_),
40 auth_token); 38 auth_token);
41 #else // !defined(NTLM_SSPI) 39 #else // !defined(NTLM_SSPI)
42 // TODO(cbentzel): Shouldn't be hitting this case. 40 // TODO(cbentzel): Shouldn't be hitting this case.
43 if (!credentials) { 41 if (!credentials) {
44 LOG(ERROR) << "Username and password are expected to be non-NULL."; 42 LOG(ERROR) << "Username and password are expected to be non-NULL.";
45 return ERR_MISSING_AUTH_CREDENTIALS; 43 return ERR_MISSING_AUTH_CREDENTIALS;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // static 138 // static
141 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { 139 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) {
142 // The service principal name of the destination server. See 140 // The service principal name of the destination server. See
143 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx 141 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx
144 std::wstring target(L"HTTP/"); 142 std::wstring target(L"HTTP/");
145 target.append(ASCIIToWide(GetHostAndPort(origin))); 143 target.append(ASCIIToWide(GetHostAndPort(origin)));
146 return target; 144 return target;
147 } 145 }
148 146
149 } // namespace net 147 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698