OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 // This contains the portable and the SSPI implementations for NTLM. | 10 // This contains the portable and the SSPI implementations for NTLM. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 GenerateRandomProc old_random_proc_; | 59 GenerateRandomProc old_random_proc_; |
60 HostNameProc old_host_name_proc_; | 60 HostNameProc old_host_name_proc_; |
61 }; | 61 }; |
62 #endif | 62 #endif |
63 | 63 |
64 HttpAuthHandlerNTLM(); | 64 HttpAuthHandlerNTLM(); |
65 | 65 |
66 virtual ~HttpAuthHandlerNTLM(); | |
67 | |
68 virtual bool NeedsIdentity(); | 66 virtual bool NeedsIdentity(); |
69 | 67 |
70 virtual bool IsFinalRound(); | 68 virtual bool IsFinalRound(); |
71 | 69 |
72 virtual std::string GenerateCredentials(const std::wstring& username, | 70 virtual std::string GenerateCredentials(const std::wstring& username, |
73 const std::wstring& password, | 71 const std::wstring& password, |
74 const HttpRequestInfo* request, | 72 const HttpRequestInfo* request, |
75 const ProxyInfo* proxy); | 73 const ProxyInfo* proxy); |
76 | 74 |
77 protected: | 75 protected: |
78 virtual bool Init(std::string::const_iterator challenge_begin, | 76 virtual bool Init(std::string::const_iterator challenge_begin, |
79 std::string::const_iterator challenge_end) { | 77 std::string::const_iterator challenge_end) { |
80 return ParseChallenge(challenge_begin, challenge_end); | 78 return ParseChallenge(challenge_begin, challenge_end); |
81 } | 79 } |
82 | 80 |
83 // This function acquires a credentials handle in the SSPI implementation. | 81 // This function acquires a credentials handle in the SSPI implementation. |
84 // It does nothing in the portable implementation. | 82 // It does nothing in the portable implementation. |
85 int InitializeBeforeFirstChallenge(); | 83 int InitializeBeforeFirstChallenge(); |
86 | 84 |
87 private: | 85 private: |
| 86 ~HttpAuthHandlerNTLM(); |
| 87 |
88 #if defined(NTLM_PORTABLE) | 88 #if defined(NTLM_PORTABLE) |
89 // For unit tests to override the GenerateRandom and GetHostName functions. | 89 // For unit tests to override the GenerateRandom and GetHostName functions. |
90 // Returns the old function. | 90 // Returns the old function. |
91 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); | 91 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); |
92 static HostNameProc SetHostNameProc(HostNameProc proc); | 92 static HostNameProc SetHostNameProc(HostNameProc proc); |
93 #endif | 93 #endif |
94 | 94 |
95 // Parse the challenge, saving the results into this instance. | 95 // Parse the challenge, saving the results into this instance. |
96 // Returns true on success. | 96 // Returns true on success. |
97 bool ParseChallenge(std::string::const_iterator challenge_begin, | 97 bool ParseChallenge(std::string::const_iterator challenge_begin, |
(...skipping 26 matching lines...) Expand all Loading... |
124 #if defined(NTLM_SSPI) | 124 #if defined(NTLM_SSPI) |
125 ULONG max_token_len_; | 125 ULONG max_token_len_; |
126 CredHandle cred_; | 126 CredHandle cred_; |
127 CtxtHandle ctxt_; | 127 CtxtHandle ctxt_; |
128 #endif | 128 #endif |
129 }; | 129 }; |
130 | 130 |
131 } // namespace net | 131 } // namespace net |
132 | 132 |
133 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 133 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
OLD | NEW |