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 #pragma once | 10 #pragma once |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool AllowsExplicitCredentials() const; | 135 bool AllowsExplicitCredentials() const; |
136 | 136 |
137 HttpAuth::AuthorizationResult ParseChallenge( | 137 HttpAuth::AuthorizationResult ParseChallenge( |
138 HttpAuth::ChallengeTokenizer* tok); | 138 HttpAuth::ChallengeTokenizer* tok); |
139 | 139 |
140 // Generates an authentication token for the service specified by the | 140 // Generates an authentication token for the service specified by the |
141 // Service Principal Name |spn| and stores the value in |*auth_token|. | 141 // Service Principal Name |spn| and stores the value in |*auth_token|. |
142 // If the return value is not |OK|, then the value of |*auth_token| is | 142 // If the return value is not |OK|, then the value of |*auth_token| is |
143 // unspecified. ERR_IO_PENDING is not a valid return code. | 143 // unspecified. ERR_IO_PENDING is not a valid return code. |
144 // If this is the first round of a multiple round scheme, credentials are | 144 // If this is the first round of a multiple round scheme, credentials are |
145 // obtained using |*username| and |*password|. If |username| and |password| | 145 // obtained using |*credentials|. If |credentials| is NULL, the credentials |
146 // are both NULL, the credentials for the currently logged in user are used | 146 // for the currently logged in user are used instead. |
147 // instead. | 147 int GenerateAuthToken(const AuthCredentials* credentials, |
148 int GenerateAuthToken(const string16* username, | |
149 const string16* password, | |
150 const std::wstring& spn, | 148 const std::wstring& spn, |
151 std::string* auth_token); | 149 std::string* auth_token); |
152 | 150 |
153 // Delegation is allowed on the Kerberos ticket. This allows certain servers | 151 // Delegation is allowed on the Kerberos ticket. This allows certain servers |
154 // to act as the user, such as an IIS server retrieiving data from a | 152 // to act as the user, such as an IIS server retrieiving data from a |
155 // Kerberized MSSQL server. | 153 // Kerberized MSSQL server. |
156 void Delegate(); | 154 void Delegate(); |
157 | 155 |
158 private: | 156 private: |
159 int OnFirstRound(const string16* username, const string16* password); | 157 int OnFirstRound(const AuthCredentials* credentials); |
160 | 158 |
161 int GetNextSecurityToken( | 159 int GetNextSecurityToken( |
162 const std::wstring& spn, | 160 const std::wstring& spn, |
163 const void* in_token, | 161 const void* in_token, |
164 int in_token_len, | 162 int in_token_len, |
165 void** out_token, | 163 void** out_token, |
166 int* out_token_len); | 164 int* out_token_len); |
167 | 165 |
168 void ResetSecurityContext(); | 166 void ResetSecurityContext(); |
169 | 167 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem | 199 // If the return value is ERR_UNEXPECTED, there was an unanticipated problem |
202 // in the underlying SSPI call. The details are logged, and |*max_token_length| | 200 // in the underlying SSPI call. The details are logged, and |*max_token_length| |
203 // is not changed. | 201 // is not changed. |
204 NET_EXPORT_PRIVATE int DetermineMaxTokenLength(SSPILibrary* library, | 202 NET_EXPORT_PRIVATE int DetermineMaxTokenLength(SSPILibrary* library, |
205 const std::wstring& package, | 203 const std::wstring& package, |
206 ULONG* max_token_length); | 204 ULONG* max_token_length); |
207 | 205 |
208 } // namespace net | 206 } // namespace net |
209 | 207 |
210 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ | 208 #endif // NET_HTTP_HTTP_AUTH_SSPI_WIN_H_ |
OLD | NEW |