| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class URLSecurityManager; | 35 class URLSecurityManager; |
| 36 | 36 |
| 37 // Code for handling HTTP NTLM authentication. | 37 // Code for handling HTTP NTLM authentication. |
| 38 class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler { | 38 class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler { |
| 39 public: | 39 public: |
| 40 class Factory : public HttpAuthHandlerFactory { | 40 class Factory : public HttpAuthHandlerFactory { |
| 41 public: | 41 public: |
| 42 Factory(); | 42 Factory(); |
| 43 virtual ~Factory(); | 43 virtual ~Factory(); |
| 44 | 44 |
| 45 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, | 45 virtual int CreateAuthHandler( |
| 46 HttpAuth::Target target, | 46 HttpAuth::ChallengeTokenizer* challenge, |
| 47 const GURL& origin, | 47 HttpAuth::Target target, |
| 48 CreateReason reason, | 48 const GURL& origin, |
| 49 int digest_nonce_count, | 49 CreateReason reason, |
| 50 const BoundNetLog& net_log, | 50 int digest_nonce_count, |
| 51 scoped_ptr<HttpAuthHandler>* handler); | 51 const BoundNetLog& net_log, |
| 52 scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; |
| 52 #if defined(NTLM_SSPI) | 53 #if defined(NTLM_SSPI) |
| 53 // Set the SSPILibrary to use. Typically the only callers which need to use | 54 // 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 | 55 // 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 | 56 // library. After the call |sspi_library| will be owned by this Factory and |
| 56 // will be destroyed when the Factory is destroyed. | 57 // will be destroyed when the Factory is destroyed. |
| 57 void set_sspi_library(SSPILibrary* sspi_library) { | 58 void set_sspi_library(SSPILibrary* sspi_library) { |
| 58 sspi_library_.reset(sspi_library); | 59 sspi_library_.reset(sspi_library); |
| 59 } | 60 } |
| 60 #endif // defined(NTLM_SSPI) | 61 #endif // defined(NTLM_SSPI) |
| 61 private: | 62 private: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #endif | 98 #endif |
| 98 | 99 |
| 99 #if defined(NTLM_PORTABLE) | 100 #if defined(NTLM_PORTABLE) |
| 100 HttpAuthHandlerNTLM(); | 101 HttpAuthHandlerNTLM(); |
| 101 #endif | 102 #endif |
| 102 #if defined(NTLM_SSPI) | 103 #if defined(NTLM_SSPI) |
| 103 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, | 104 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, |
| 104 URLSecurityManager* url_security_manager); | 105 URLSecurityManager* url_security_manager); |
| 105 #endif | 106 #endif |
| 106 | 107 |
| 107 virtual bool NeedsIdentity(); | 108 virtual bool NeedsIdentity() OVERRIDE; |
| 108 | 109 |
| 109 virtual bool AllowsDefaultCredentials(); | 110 virtual bool AllowsDefaultCredentials() OVERRIDE; |
| 110 | 111 |
| 111 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 112 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 112 HttpAuth::ChallengeTokenizer* challenge); | 113 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 113 | 114 |
| 114 protected: | 115 protected: |
| 115 // This function acquires a credentials handle in the SSPI implementation. | 116 // This function acquires a credentials handle in the SSPI implementation. |
| 116 // It does nothing in the portable implementation. | 117 // It does nothing in the portable implementation. |
| 117 int InitializeBeforeFirstChallenge(); | 118 int InitializeBeforeFirstChallenge(); |
| 118 | 119 |
| 119 virtual bool Init(HttpAuth::ChallengeTokenizer* tok); | 120 virtual bool Init(HttpAuth::ChallengeTokenizer* tok) OVERRIDE; |
| 120 | 121 |
| 121 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 122 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 122 const HttpRequestInfo* request, | 123 const HttpRequestInfo* request, |
| 123 OldCompletionCallback* callback, | 124 OldCompletionCallback* callback, |
| 124 std::string* auth_token); | 125 std::string* auth_token) OVERRIDE; |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 virtual ~HttpAuthHandlerNTLM(); | 128 virtual ~HttpAuthHandlerNTLM(); |
| 128 | 129 |
| 129 #if defined(NTLM_PORTABLE) | 130 #if defined(NTLM_PORTABLE) |
| 130 // For unit tests to override the GenerateRandom and GetHostName functions. | 131 // For unit tests to override the GenerateRandom and GetHostName functions. |
| 131 // Returns the old function. | 132 // Returns the old function. |
| 132 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); | 133 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); |
| 133 static HostNameProc SetHostNameProc(HostNameProc proc); | 134 static HostNameProc SetHostNameProc(HostNameProc proc); |
| 134 #endif | 135 #endif |
| (...skipping 29 matching lines...) Expand all Loading... |
| 164 std::string auth_data_; | 165 std::string auth_data_; |
| 165 | 166 |
| 166 #if defined(NTLM_SSPI) | 167 #if defined(NTLM_SSPI) |
| 167 URLSecurityManager* url_security_manager_; | 168 URLSecurityManager* url_security_manager_; |
| 168 #endif | 169 #endif |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 } // namespace net | 172 } // namespace net |
| 172 | 173 |
| 173 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 174 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
| OLD | NEW |