Chromium Code Reviews| 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 #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 "base/string16.h" | 11 #include "base/string16.h" |
|
asanka
2011/10/28 14:39:40
base/string16.h not needed anymore.
| |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "net/base/address_list.h" | 13 #include "net/base/address_list.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/http/http_auth_handler.h" | 15 #include "net/http/http_auth_handler.h" |
| 16 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include "net/http/http_auth_sspi_win.h" | 19 #include "net/http/http_auth_sspi_win.h" |
| 20 #elif defined(OS_POSIX) | 20 #elif defined(OS_POSIX) |
| 21 #include "net/http/http_auth_gssapi_posix.h" | 21 #include "net/http/http_auth_gssapi_posix.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 // HttpAuthHandler: | 109 // HttpAuthHandler: |
| 110 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 110 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 111 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; | 111 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 112 virtual bool NeedsIdentity() OVERRIDE; | 112 virtual bool NeedsIdentity() OVERRIDE; |
| 113 virtual bool AllowsDefaultCredentials() OVERRIDE; | 113 virtual bool AllowsDefaultCredentials() OVERRIDE; |
| 114 virtual bool AllowsExplicitCredentials() OVERRIDE; | 114 virtual bool AllowsExplicitCredentials() OVERRIDE; |
| 115 | 115 |
| 116 protected: | 116 protected: |
| 117 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 117 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
| 118 | 118 |
| 119 virtual int GenerateAuthTokenImpl(const string16* username, | 119 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 120 const string16* password, | |
| 121 const HttpRequestInfo* request, | 120 const HttpRequestInfo* request, |
| 122 OldCompletionCallback* callback, | 121 OldCompletionCallback* callback, |
| 123 std::string* auth_token); | 122 std::string* auth_token); |
| 124 | 123 |
| 125 private: | 124 private: |
| 126 enum State { | 125 enum State { |
| 127 STATE_RESOLVE_CANONICAL_NAME, | 126 STATE_RESOLVE_CANONICAL_NAME, |
| 128 STATE_RESOLVE_CANONICAL_NAME_COMPLETE, | 127 STATE_RESOLVE_CANONICAL_NAME_COMPLETE, |
| 129 STATE_GENERATE_AUTH_TOKEN, | 128 STATE_GENERATE_AUTH_TOKEN, |
| 130 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 129 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 146 bool use_port_; | 145 bool use_port_; |
| 147 OldCompletionCallbackImpl<HttpAuthHandlerNegotiate> io_callback_; | 146 OldCompletionCallbackImpl<HttpAuthHandlerNegotiate> io_callback_; |
| 148 HostResolver* const resolver_; | 147 HostResolver* const resolver_; |
| 149 | 148 |
| 150 // Members which are needed for DNS lookup + SPN. | 149 // Members which are needed for DNS lookup + SPN. |
| 151 AddressList address_list_; | 150 AddressList address_list_; |
| 152 scoped_ptr<SingleRequestHostResolver> single_resolve_; | 151 scoped_ptr<SingleRequestHostResolver> single_resolve_; |
| 153 | 152 |
| 154 // Things which should be consistent after first call to GenerateAuthToken. | 153 // Things which should be consistent after first call to GenerateAuthToken. |
| 155 bool already_called_; | 154 bool already_called_; |
| 156 bool has_username_and_password_; | 155 bool has_credentials_; |
| 157 string16 username_; | 156 AuthCredentials credentials_; |
| 158 string16 password_; | |
| 159 std::wstring spn_; | 157 std::wstring spn_; |
| 160 | 158 |
| 161 // Things which vary each round. | 159 // Things which vary each round. |
| 162 OldCompletionCallback* user_callback_; | 160 OldCompletionCallback* user_callback_; |
| 163 std::string* auth_token_; | 161 std::string* auth_token_; |
| 164 | 162 |
| 165 State next_state_; | 163 State next_state_; |
| 166 | 164 |
| 167 const URLSecurityManager* url_security_manager_; | 165 const URLSecurityManager* url_security_manager_; |
| 168 }; | 166 }; |
| 169 | 167 |
| 170 } // namespace net | 168 } // namespace net |
| 171 | 169 |
| 172 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 170 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
| OLD | NEW |