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