| OLD | NEW |
| 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 #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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (!base64_rv) { | 86 if (!base64_rv) { |
| 87 LOG(ERROR) << "Unexpected problem Base64 encoding."; | 87 LOG(ERROR) << "Unexpected problem Base64 encoding."; |
| 88 return ERR_UNEXPECTED; | 88 return ERR_UNEXPECTED; |
| 89 } | 89 } |
| 90 *auth_token = std::string("NTLM ") + encode_output; | 90 *auth_token = std::string("NTLM ") + encode_output; |
| 91 return OK; | 91 return OK; |
| 92 #endif | 92 #endif |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool HttpAuthHandlerNTLM::Init(HttpAuth::ChallengeTokenizer* tok) { | 95 bool HttpAuthHandlerNTLM::Init(HttpAuth::ChallengeTokenizer* tok) { |
| 96 auth_scheme_ = AUTH_SCHEME_NTLM; | 96 auth_scheme_ = HttpAuth::AUTH_SCHEME_NTLM; |
| 97 scheme_ = "ntlm"; | |
| 98 score_ = 3; | 97 score_ = 3; |
| 99 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; | 98 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; |
| 100 | 99 |
| 101 return ParseChallenge(tok, true) == HttpAuth::AUTHORIZATION_RESULT_ACCEPT; | 100 return ParseChallenge(tok, true) == HttpAuth::AUTHORIZATION_RESULT_ACCEPT; |
| 102 } | 101 } |
| 103 | 102 |
| 104 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::HandleAnotherChallenge( | 103 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::HandleAnotherChallenge( |
| 105 HttpAuth::ChallengeTokenizer* challenge) { | 104 HttpAuth::ChallengeTokenizer* challenge) { |
| 106 return ParseChallenge(challenge, false); | 105 return ParseChallenge(challenge, false); |
| 107 } | 106 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // static | 142 // static |
| 144 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { | 143 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { |
| 145 // The service principal name of the destination server. See | 144 // The service principal name of the destination server. See |
| 146 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx | 145 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx |
| 147 std::wstring target(L"HTTP/"); | 146 std::wstring target(L"HTTP/"); |
| 148 target.append(ASCIIToWide(GetHostAndPort(origin))); | 147 target.append(ASCIIToWide(GetHostAndPort(origin))); |
| 149 return target; | 148 return target; |
| 150 } | 149 } |
| 151 | 150 |
| 152 } // namespace net | 151 } // namespace net |
| OLD | NEW |