| 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_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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #if defined(NTLM_PORTABLE) | 101 #if defined(NTLM_PORTABLE) |
| 102 HttpAuthHandlerNTLM(); | 102 HttpAuthHandlerNTLM(); |
| 103 #endif | 103 #endif |
| 104 #if defined(NTLM_SSPI) | 104 #if defined(NTLM_SSPI) |
| 105 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, | 105 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, |
| 106 URLSecurityManager* url_security_manager); | 106 URLSecurityManager* url_security_manager); |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 virtual bool NeedsIdentity(); | 109 virtual bool NeedsIdentity(); |
| 110 | 110 |
| 111 virtual bool IsFinalRound(); | |
| 112 | |
| 113 virtual bool AllowsDefaultCredentials(); | 111 virtual bool AllowsDefaultCredentials(); |
| 114 | 112 |
| 113 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 114 HttpAuth::ChallengeTokenizer* challenge); |
| 115 |
| 115 protected: | 116 protected: |
| 116 virtual bool Init(HttpAuth::ChallengeTokenizer* tok) { | 117 virtual bool Init(HttpAuth::ChallengeTokenizer* tok); |
| 117 return ParseChallenge(tok); | |
| 118 } | |
| 119 | 118 |
| 120 virtual int GenerateAuthTokenImpl(const string16* username, | 119 virtual int GenerateAuthTokenImpl(const string16* username, |
| 121 const string16* password, | 120 const string16* password, |
| 122 const HttpRequestInfo* request, | 121 const HttpRequestInfo* request, |
| 123 CompletionCallback* callback, | 122 CompletionCallback* callback, |
| 124 std::string* auth_token); | 123 std::string* auth_token); |
| 125 | 124 |
| 126 // This function acquires a credentials handle in the SSPI implementation. | 125 // This function acquires a credentials handle in the SSPI implementation. |
| 127 // It does nothing in the portable implementation. | 126 // It does nothing in the portable implementation. |
| 128 int InitializeBeforeFirstChallenge(); | 127 int InitializeBeforeFirstChallenge(); |
| 129 | 128 |
| 130 private: | 129 private: |
| 131 ~HttpAuthHandlerNTLM(); | 130 ~HttpAuthHandlerNTLM(); |
| 132 | 131 |
| 133 #if defined(NTLM_PORTABLE) | 132 #if defined(NTLM_PORTABLE) |
| 134 // For unit tests to override the GenerateRandom and GetHostName functions. | 133 // For unit tests to override the GenerateRandom and GetHostName functions. |
| 135 // Returns the old function. | 134 // Returns the old function. |
| 136 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); | 135 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); |
| 137 static HostNameProc SetHostNameProc(HostNameProc proc); | 136 static HostNameProc SetHostNameProc(HostNameProc proc); |
| 138 #endif | 137 #endif |
| 139 | 138 |
| 140 // Parse the challenge, saving the results into this instance. | 139 // Parse the challenge, saving the results into this instance. |
| 141 // Returns true on success. | 140 HttpAuth::AuthorizationResult ParseChallenge( |
| 142 bool ParseChallenge(HttpAuth::ChallengeTokenizer* tok); | 141 HttpAuth::ChallengeTokenizer* tok, bool initial_challenge); |
| 143 | 142 |
| 144 // Given an input token received from the server, generate the next output | 143 // Given an input token received from the server, generate the next output |
| 145 // token to be sent to the server. | 144 // token to be sent to the server. |
| 146 int GetNextToken(const void* in_token, | 145 int GetNextToken(const void* in_token, |
| 147 uint32 in_token_len, | 146 uint32 in_token_len, |
| 148 void** out_token, | 147 void** out_token, |
| 149 uint32* out_token_len); | 148 uint32* out_token_len); |
| 150 | 149 |
| 151 // Create an NTLM SPN to identify the |origin| server. | 150 // Create an NTLM SPN to identify the |origin| server. |
| 152 static std::wstring CreateSPN(const GURL& origin); | 151 static std::wstring CreateSPN(const GURL& origin); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 169 std::string auth_data_; | 168 std::string auth_data_; |
| 170 | 169 |
| 171 #if defined(NTLM_SSPI) | 170 #if defined(NTLM_SSPI) |
| 172 URLSecurityManager* url_security_manager_; | 171 URLSecurityManager* url_security_manager_; |
| 173 #endif | 172 #endif |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 } // namespace net | 175 } // namespace net |
| 177 | 176 |
| 178 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ | 177 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ |
| OLD | NEW |