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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "build/build_config.h" | 11 #include "base/string16.h" |
12 | |
13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
14 #include "net/base/address_list.h" | 13 #include "net/base/address_list.h" |
15 #include "net/http/http_auth_handler.h" | 14 #include "net/http/http_auth_handler.h" |
16 #include "net/http/http_auth_handler_factory.h" | 15 #include "net/http/http_auth_handler_factory.h" |
17 | 16 |
18 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
19 #include "net/http/http_auth_sspi_win.h" | 18 #include "net/http/http_auth_sspi_win.h" |
20 #elif defined(OS_POSIX) | 19 #elif defined(OS_POSIX) |
21 #include "net/http/http_auth_gssapi_posix.h" | 20 #include "net/http/http_auth_gssapi_posix.h" |
22 #endif | 21 #endif |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 111 |
113 virtual bool AllowsDefaultCredentials(); | 112 virtual bool AllowsDefaultCredentials(); |
114 | 113 |
115 // These are public for unit tests | 114 // These are public for unit tests |
116 std::wstring CreateSPN(const AddressList& address_list, const GURL& orign); | 115 std::wstring CreateSPN(const AddressList& address_list, const GURL& orign); |
117 const std::wstring& spn() const { return spn_; } | 116 const std::wstring& spn() const { return spn_; } |
118 | 117 |
119 protected: | 118 protected: |
120 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 119 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
121 | 120 |
122 virtual int GenerateAuthTokenImpl(const std::wstring* username, | 121 virtual int GenerateAuthTokenImpl(const string16* username, |
123 const std::wstring* password, | 122 const string16* password, |
124 const HttpRequestInfo* request, | 123 const HttpRequestInfo* request, |
125 CompletionCallback* callback, | 124 CompletionCallback* callback, |
126 std::string* auth_token); | 125 std::string* auth_token); |
127 | 126 |
128 private: | 127 private: |
129 enum State { | 128 enum State { |
130 STATE_RESOLVE_CANONICAL_NAME, | 129 STATE_RESOLVE_CANONICAL_NAME, |
131 STATE_RESOLVE_CANONICAL_NAME_COMPLETE, | 130 STATE_RESOLVE_CANONICAL_NAME_COMPLETE, |
132 STATE_GENERATE_AUTH_TOKEN, | 131 STATE_GENERATE_AUTH_TOKEN, |
133 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 132 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
(...skipping 15 matching lines...) Expand all Loading... |
149 CompletionCallbackImpl<HttpAuthHandlerNegotiate> io_callback_; | 148 CompletionCallbackImpl<HttpAuthHandlerNegotiate> io_callback_; |
150 scoped_refptr<HostResolver> resolver_; | 149 scoped_refptr<HostResolver> resolver_; |
151 | 150 |
152 // Members which are needed for DNS lookup + SPN. | 151 // Members which are needed for DNS lookup + SPN. |
153 AddressList address_list_; | 152 AddressList address_list_; |
154 scoped_ptr<SingleRequestHostResolver> single_resolve_; | 153 scoped_ptr<SingleRequestHostResolver> single_resolve_; |
155 | 154 |
156 // Things which should be consistent after first call to GenerateAuthToken. | 155 // Things which should be consistent after first call to GenerateAuthToken. |
157 bool already_called_; | 156 bool already_called_; |
158 bool has_username_and_password_; | 157 bool has_username_and_password_; |
159 std::wstring username_; | 158 string16 username_; |
160 std::wstring password_; | 159 string16 password_; |
161 std::wstring spn_; | 160 std::wstring spn_; |
162 | 161 |
163 // Things which vary each round. | 162 // Things which vary each round. |
164 CompletionCallback* user_callback_; | 163 CompletionCallback* user_callback_; |
165 std::string* auth_token_; | 164 std::string* auth_token_; |
166 | 165 |
167 State next_state_; | 166 State next_state_; |
168 | 167 |
169 URLSecurityManager* url_security_manager_; | 168 URLSecurityManager* url_security_manager_; |
170 }; | 169 }; |
171 | 170 |
172 } // namespace net | 171 } // namespace net |
173 | 172 |
174 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 173 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
OLD | NEW |