OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "net/http/http_auth_handler.h" |
| 12 |
| 13 namespace net { |
| 14 |
| 15 class NTLMAuthModule; |
| 16 |
| 17 // Code for handling HTTP NTLM authentication. |
| 18 class HttpAuthHandlerNTLM : public HttpAuthHandler { |
| 19 public: |
| 20 HttpAuthHandlerNTLM(); |
| 21 |
| 22 virtual ~HttpAuthHandlerNTLM(); |
| 23 |
| 24 virtual bool NeedsIdentity(); |
| 25 |
| 26 virtual std::string GenerateCredentials(const std::wstring& username, |
| 27 const std::wstring& password, |
| 28 const HttpRequestInfo* request, |
| 29 const ProxyInfo* proxy); |
| 30 |
| 31 protected: |
| 32 virtual bool Init(std::string::const_iterator challenge_begin, |
| 33 std::string::const_iterator challenge_end) { |
| 34 return ParseChallenge(challenge_begin, challenge_end); |
| 35 } |
| 36 |
| 37 private: |
| 38 // Parse the challenge, saving the results into this instance. |
| 39 // Returns true on success. |
| 40 bool ParseChallenge(std::string::const_iterator challenge_begin, |
| 41 std::string::const_iterator challenge_end); |
| 42 |
| 43 // The actual implementation of NTLM. |
| 44 // |
| 45 // TODO(wtc): This artificial separation of the NTLM auth module from the |
| 46 // NTLM auth handler comes from the Mozilla code. It is due to an |
| 47 // architecture constraint of Mozilla's (all crypto code must reside in the |
| 48 // "PSM" component), so that the NTLM code, which does crypto, must be |
| 49 // separated from the "netwerk" component. Our source tree doesn't have |
| 50 // this constraint, so we may want to merge NTLMAuthModule into this class. |
| 51 scoped_ptr<NTLMAuthModule> ntlm_module_; |
| 52 |
| 53 // The base64-encoded string following "NTLM" in the "WWW-Authenticate" or |
| 54 // "Proxy-Authenticate" response header. |
| 55 std::string auth_data_; |
| 56 }; |
| 57 |
| 58 } // namespace net |
| 59 |
| 60 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
OLD | NEW |