| OLD | NEW |
| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::HandleAnotherChallenge( | 18 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::HandleAnotherChallenge( |
| 19 HttpAuth::ChallengeTokenizer* challenge) { | 19 HttpAuth::ChallengeTokenizer* challenge) { |
| 20 return ParseChallenge(challenge, false); | 20 return ParseChallenge(challenge, false); |
| 21 } | 21 } |
| 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_ = "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, const HttpRequestInfo* request, | 32 const AuthCredentials* credentials, const HttpRequestInfo* request, |
| 33 const CompletionCallback& callback, std::string* auth_token) { | 33 const CompletionCallback& callback, std::string* auth_token) { |
| 34 #if defined(NTLM_SSPI) | 34 #if defined(NTLM_SSPI) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // static | 138 // static |
| 139 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { | 139 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { |
| 140 // The service principal name of the destination server. See | 140 // The service principal name of the destination server. See |
| 141 // 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 |
| 142 std::wstring target(L"HTTP/"); | 142 std::wstring target(L"HTTP/"); |
| 143 target.append(ASCIIToWide(GetHostAndPort(origin))); | 143 target.append(ASCIIToWide(GetHostAndPort(origin))); |
| 144 return target; | 144 return target; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace net | 147 } // namespace net |
| OLD | NEW |