| 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 // This file contains common routines used by NTLM and Negotiate authentication | 5 // This file contains common routines used by NTLM and Negotiate authentication |
| 6 // using the SSPI API on Windows. | 6 // using the SSPI API on Windows. |
| 7 | 7 |
| 8 #ifndef NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 8 #ifndef NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
| 9 #define NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 9 #define NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
| 10 | 10 |
| 11 // security.h needs to be included for CredHandle. Unfortunately CredHandle | 11 // security.h needs to be included for CredHandle. Unfortunately CredHandle |
| 12 // is a typedef and can't be forward declared. | 12 // is a typedef and can't be forward declared. |
| 13 #define SECURITY_WIN32 1 | 13 #define SECURITY_WIN32 1 |
| 14 #include <windows.h> | 14 #include <windows.h> |
| 15 #include <security.h> | 15 #include <security.h> |
| 16 | 16 |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 #include "net/http/http_auth.h" | 19 #include "net/http/http_auth.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class HttpRequestInfo; | 25 struct HttpRequestInfo; |
| 26 class ProxyInfo; | 26 class ProxyInfo; |
| 27 | 27 |
| 28 // SSPILibrary is introduced so unit tests can mock the calls to Windows' SSPI | 28 // SSPILibrary is introduced so unit tests can mock the calls to Windows' SSPI |
| 29 // implementation. The default implementation simply passes the arguments on to | 29 // implementation. The default implementation simply passes the arguments on to |
| 30 // the SSPI implementation provided by Secur32.dll. | 30 // the SSPI implementation provided by Secur32.dll. |
| 31 // NOTE(cbentzel): I considered replacing the Secur32.dll with a mock DLL, but | 31 // NOTE(cbentzel): I considered replacing the Secur32.dll with a mock DLL, but |
| 32 // decided that it wasn't worth the effort as this is unlikely to be performance | 32 // decided that it wasn't worth the effort as this is unlikely to be performance |
| 33 // sensitive code. | 33 // sensitive code. |
| 34 class SSPILibrary { | 34 class SSPILibrary { |
| 35 public: | 35 public: |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem | 145 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem |
| 146 // in the underlying SSPI call. The details are logged, and |*max_token_length| | 146 // in the underlying SSPI call. The details are logged, and |*max_token_length| |
| 147 // is not changed. | 147 // is not changed. |
| 148 int DetermineMaxTokenLength(SSPILibrary* library, | 148 int DetermineMaxTokenLength(SSPILibrary* library, |
| 149 const std::wstring& package, | 149 const std::wstring& package, |
| 150 ULONG* max_token_length); | 150 ULONG* max_token_length); |
| 151 | 151 |
| 152 } // namespace net | 152 } // namespace net |
| 153 | 153 |
| 154 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 154 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
| 155 | |
| OLD | NEW |