| 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_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 28 matching lines...) Expand all Loading... |
| 39 class Factory : public HttpAuthHandlerFactory { | 39 class Factory : public HttpAuthHandlerFactory { |
| 40 public: | 40 public: |
| 41 Factory(); | 41 Factory(); |
| 42 ~Factory() override; | 42 ~Factory() override; |
| 43 | 43 |
| 44 // HttpAuthHandlerFactory | 44 // HttpAuthHandlerFactory |
| 45 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme( | 45 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme( |
| 46 const std::string& scheme) override; | 46 const std::string& scheme) override; |
| 47 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler( | 47 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler( |
| 48 HttpAuthCache::Entry* cache_entry, | 48 HttpAuthCache::Entry* cache_entry, |
| 49 const HttpAuthChallengeTokenizer& tokenizer, | |
| 50 HttpAuth::Target target, | 49 HttpAuth::Target target, |
| 51 const BoundNetLog& net_log) override; | 50 const BoundNetLog& net_log) override; |
| 52 #if defined(NTLM_SSPI) | 51 #if defined(NTLM_SSPI) |
| 53 // Set the SSPILibrary to use. Typically the only callers which need to use | 52 // Set the SSPILibrary to use. Typically the only callers which need to use |
| 54 // this are unit tests which pass in a mocked-out version of the SSPI | 53 // this are unit tests which pass in a mocked-out version of the SSPI |
| 55 // library. After the call |sspi_library| will be owned by this Factory and | 54 // library. After the call |sspi_library| will be owned by this Factory and |
| 56 // will be destroyed when the Factory is destroyed. | 55 // will be destroyed when the Factory is destroyed. |
| 57 void set_sspi_library(SSPILibrary* sspi_library) { | 56 void set_sspi_library(SSPILibrary* sspi_library) { |
| 58 sspi_library_.reset(sspi_library); | 57 sspi_library_.reset(sspi_library); |
| 59 } | 58 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 bool AllowsDefaultCredentials() override; | 108 bool AllowsDefaultCredentials() override; |
| 110 HttpAuth::AuthorizationResult HandleAnotherChallenge( | 109 HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 111 const HttpAuthChallengeTokenizer& challenge) override; | 110 const HttpAuthChallengeTokenizer& challenge) override; |
| 112 | 111 |
| 113 protected: | 112 protected: |
| 114 // This function acquires a credentials handle in the SSPI implementation. | 113 // This function acquires a credentials handle in the SSPI implementation. |
| 115 // It does nothing in the portable implementation. | 114 // It does nothing in the portable implementation. |
| 116 int InitializeBeforeFirstChallenge(); | 115 int InitializeBeforeFirstChallenge(); |
| 117 | 116 |
| 118 // HttpAuthHandler | 117 // HttpAuthHandler |
| 119 int Init(const HttpAuthChallengeTokenizer& tok) override; | 118 int InitializeFromChallengeInternal( |
| 119 const HttpAuthChallengeTokenizer& challenge, |
| 120 const HttpResponseInfo& response_with_challenge, |
| 121 const CompletionCallback& callback) override; |
| 122 int InitializeFromCacheEntryInternal( |
| 123 HttpAuthCache::Entry* cache_entry) override; |
| 120 int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 124 int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 121 const HttpRequestInfo& request, | 125 const HttpRequestInfo& request, |
| 122 const CompletionCallback& callback, | 126 const CompletionCallback& callback, |
| 123 std::string* auth_token) override; | 127 std::string* auth_token) override; |
| 124 | 128 |
| 125 private: | 129 private: |
| 126 #if defined(NTLM_PORTABLE) | 130 #if defined(NTLM_PORTABLE) |
| 127 // For unit tests to override the GenerateRandom and GetHostName functions. | 131 // For unit tests to override the GenerateRandom and GetHostName functions. |
| 128 // Returns the old function. | 132 // Returns the old function. |
| 129 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); | 133 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 std::string auth_data_; | 166 std::string auth_data_; |
| 163 | 167 |
| 164 #if defined(NTLM_SSPI) | 168 #if defined(NTLM_SSPI) |
| 165 URLSecurityManager* url_security_manager_; | 169 URLSecurityManager* url_security_manager_; |
| 166 #endif | 170 #endif |
| 167 }; | 171 }; |
| 168 | 172 |
| 169 } // namespace net | 173 } // namespace net |
| 170 | 174 |
| 171 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 175 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
| OLD | NEW |