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 // See "SSPI Sample Application" at | 5 // See "SSPI Sample Application" at |
6 // http://msdn.microsoft.com/en-us/library/aa918273.aspx | 6 // http://msdn.microsoft.com/en-us/library/aa918273.aspx |
7 | 7 |
8 #include "net/http/http_auth_sspi_win.h" | 8 #include "net/http/http_auth_sspi_win.h" |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 void HttpAuthSSPI::ResetSecurityContext() { | 277 void HttpAuthSSPI::ResetSecurityContext() { |
278 if (SecIsValidHandle(&ctxt_)) { | 278 if (SecIsValidHandle(&ctxt_)) { |
279 library_->DeleteSecurityContext(&ctxt_); | 279 library_->DeleteSecurityContext(&ctxt_); |
280 SecInvalidateHandle(&ctxt_); | 280 SecInvalidateHandle(&ctxt_); |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( | 284 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( |
285 HttpAuthChallengeTokenizer* tok) { | 285 const HttpAuthChallengeTokenizer& tok) { |
286 if (!SecIsValidHandle(&ctxt_)) { | 286 if (!SecIsValidHandle(&ctxt_)) { |
287 return net::ParseFirstRoundChallenge(scheme_, tok); | 287 return ParseFirstRoundChallenge(scheme_, tok); |
288 } | 288 } |
289 std::string encoded_auth_token; | 289 std::string encoded_auth_token; |
290 return net::ParseLaterRoundChallenge(scheme_, tok, &encoded_auth_token, | 290 return ParseLaterRoundChallenge(scheme_, tok, &encoded_auth_token, |
291 &decoded_server_auth_token_); | 291 &decoded_server_auth_token_); |
292 } | 292 } |
293 | 293 |
294 int HttpAuthSSPI::GenerateAuthToken(const AuthCredentials* credentials, | 294 int HttpAuthSSPI::GenerateAuthToken(const AuthCredentials* credentials, |
295 const std::string& spn, | 295 const std::string& spn, |
296 std::string* auth_token, | 296 std::string* auth_token, |
297 const CompletionCallback& /*callback*/) { | 297 const CompletionCallback& /*callback*/) { |
298 // Initial challenge. | 298 // Initial challenge. |
299 if (!SecIsValidHandle(&cred_)) { | 299 if (!SecIsValidHandle(&cred_)) { |
300 int rv = OnFirstRound(credentials); | 300 int rv = OnFirstRound(credentials); |
301 if (rv != OK) | 301 if (rv != OK) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 int token_length = pkg_info->cbMaxToken; | 455 int token_length = pkg_info->cbMaxToken; |
456 status = library->FreeContextBuffer(pkg_info); | 456 status = library->FreeContextBuffer(pkg_info); |
457 rv = MapFreeContextBufferStatusToError(status); | 457 rv = MapFreeContextBufferStatusToError(status); |
458 if (rv != OK) | 458 if (rv != OK) |
459 return rv; | 459 return rv; |
460 *max_token_length = token_length; | 460 *max_token_length = token_length; |
461 return OK; | 461 return OK; |
462 } | 462 } |
463 | 463 |
464 } // namespace net | 464 } // namespace net |
OLD | NEW |