| 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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 PTimeStamp ptsExpiry) = 0; | 56 PTimeStamp ptsExpiry) = 0; |
| 57 | 57 |
| 58 virtual SECURITY_STATUS QuerySecurityPackageInfo(LPWSTR pszPackageName, | 58 virtual SECURITY_STATUS QuerySecurityPackageInfo(LPWSTR pszPackageName, |
| 59 PSecPkgInfoW *pkgInfo) = 0; | 59 PSecPkgInfoW *pkgInfo) = 0; |
| 60 | 60 |
| 61 virtual SECURITY_STATUS FreeCredentialsHandle(PCredHandle phCredential) = 0; | 61 virtual SECURITY_STATUS FreeCredentialsHandle(PCredHandle phCredential) = 0; |
| 62 | 62 |
| 63 virtual SECURITY_STATUS DeleteSecurityContext(PCtxtHandle phContext) = 0; | 63 virtual SECURITY_STATUS DeleteSecurityContext(PCtxtHandle phContext) = 0; |
| 64 | 64 |
| 65 virtual SECURITY_STATUS FreeContextBuffer(PVOID pvContextBuffer) = 0; | 65 virtual SECURITY_STATUS FreeContextBuffer(PVOID pvContextBuffer) = 0; |
| 66 | |
| 67 // Get the default SSPILibrary instance, which simply acts as a passthrough | |
| 68 // to the Windows SSPI implementation. The object returned is a singleton | |
| 69 // instance, and the caller should not delete it. | |
| 70 static SSPILibrary* GetDefault(); | |
| 71 }; | 66 }; |
| 72 | 67 |
| 73 class HttpAuthSSPI { | 68 class HttpAuthSSPI { |
| 74 public: | 69 public: |
| 75 HttpAuthSSPI(SSPILibrary* sspi_library, | 70 HttpAuthSSPI(SSPILibrary* sspi_library, |
| 76 const std::string& scheme, | 71 const std::string& scheme, |
| 77 SEC_WCHAR* security_package, | 72 SEC_WCHAR* security_package, |
| 78 ULONG max_token_length); | 73 ULONG max_token_length); |
| 79 ~HttpAuthSSPI(); | 74 ~HttpAuthSSPI(); |
| 80 | 75 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // 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 |
| 148 // 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| |
| 149 // is not changed. | 144 // is not changed. |
| 150 int DetermineMaxTokenLength(SSPILibrary* library, | 145 int DetermineMaxTokenLength(SSPILibrary* library, |
| 151 const std::wstring& package, | 146 const std::wstring& package, |
| 152 ULONG* max_token_length); | 147 ULONG* max_token_length); |
| 153 | 148 |
| 154 } // namespace net | 149 } // namespace net |
| 155 | 150 |
| 156 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 151 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
| OLD | NEW |