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