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 // 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 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 virtual SECURITY_STATUS FreeContextBuffer(PVOID pvContextBuffer) { | 119 virtual SECURITY_STATUS FreeContextBuffer(PVOID pvContextBuffer) { |
120 return ::FreeContextBuffer(pvContextBuffer); | 120 return ::FreeContextBuffer(pvContextBuffer); |
121 } | 121 } |
122 }; | 122 }; |
123 | 123 |
124 class NET_EXPORT_PRIVATE HttpAuthSSPI { | 124 class NET_EXPORT_PRIVATE HttpAuthSSPI { |
125 public: | 125 public: |
126 HttpAuthSSPI(SSPILibrary* sspi_library, | 126 HttpAuthSSPI(SSPILibrary* sspi_library, |
127 const std::string& scheme, | 127 const std::string& scheme, |
128 SEC_WCHAR* security_package, | 128 const SEC_WCHAR* security_package, |
129 ULONG max_token_length); | 129 ULONG max_token_length); |
130 ~HttpAuthSSPI(); | 130 ~HttpAuthSSPI(); |
131 | 131 |
132 bool NeedsIdentity() const; | 132 bool NeedsIdentity() const; |
133 | 133 |
134 bool AllowsExplicitCredentials() const; | 134 bool AllowsExplicitCredentials() const; |
135 | 135 |
136 HttpAuth::AuthorizationResult ParseChallenge( | 136 HttpAuth::AuthorizationResult ParseChallenge( |
137 HttpAuth::ChallengeTokenizer* tok); | 137 HttpAuth::ChallengeTokenizer* tok); |
138 | 138 |
(...skipping 20 matching lines...) Expand all Loading... |
159 const std::wstring& spn, | 159 const std::wstring& spn, |
160 const void* in_token, | 160 const void* in_token, |
161 int in_token_len, | 161 int in_token_len, |
162 void** out_token, | 162 void** out_token, |
163 int* out_token_len); | 163 int* out_token_len); |
164 | 164 |
165 void ResetSecurityContext(); | 165 void ResetSecurityContext(); |
166 | 166 |
167 SSPILibrary* library_; | 167 SSPILibrary* library_; |
168 std::string scheme_; | 168 std::string scheme_; |
169 SEC_WCHAR* security_package_; | 169 const SEC_WCHAR* security_package_; |
170 std::string decoded_server_auth_token_; | 170 std::string decoded_server_auth_token_; |
171 ULONG max_token_length_; | 171 ULONG max_token_length_; |
172 CredHandle cred_; | 172 CredHandle cred_; |
173 CtxtHandle ctxt_; | 173 CtxtHandle ctxt_; |
174 bool can_delegate_; | 174 bool can_delegate_; |
175 }; | 175 }; |
176 | 176 |
177 // Splits |combined| into domain and username. | 177 // Splits |combined| into domain and username. |
178 // If |combined| is of form "FOO\bar", |domain| will contain "FOO" and |user| | 178 // If |combined| is of form "FOO\bar", |domain| will contain "FOO" and |user| |
179 // will contain "bar". | 179 // will contain "bar". |
(...skipping 18 matching lines...) Expand all Loading... |
198 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem | 198 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem |
199 // in the underlying SSPI call. The details are logged, and |*max_token_length| | 199 // in the underlying SSPI call. The details are logged, and |*max_token_length| |
200 // is not changed. | 200 // is not changed. |
201 NET_EXPORT_PRIVATE int DetermineMaxTokenLength(SSPILibrary* library, | 201 NET_EXPORT_PRIVATE int DetermineMaxTokenLength(SSPILibrary* library, |
202 const std::wstring& package, | 202 const std::wstring& package, |
203 ULONG* max_token_length); | 203 ULONG* max_token_length); |
204 | 204 |
205 } // namespace net | 205 } // namespace net |
206 | 206 |
207 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 207 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
OLD | NEW |