| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 void HttpAuthSSPI::ResetSecurityContext() { | 276 void HttpAuthSSPI::ResetSecurityContext() { |
| 277 if (SecIsValidHandle(&ctxt_)) { | 277 if (SecIsValidHandle(&ctxt_)) { |
| 278 library_->DeleteSecurityContext(&ctxt_); | 278 library_->DeleteSecurityContext(&ctxt_); |
| 279 SecInvalidateHandle(&ctxt_); | 279 SecInvalidateHandle(&ctxt_); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( | 283 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( |
| 284 HttpAuthChallengeTokenizer* tok) { | 284 HttpAuthChallengeTokenizer* tok) { |
| 285 // Verify the challenge's auth-scheme. | 285 // Verify the challenge's auth-scheme. |
| 286 if (!LowerCaseEqualsASCII(tok->scheme(), | 286 if (!base::LowerCaseEqualsASCII(tok->scheme(), |
| 287 base::StringToLowerASCII(scheme_).c_str())) | 287 base::StringToLowerASCII(scheme_).c_str())) |
| 288 return HttpAuth::AUTHORIZATION_RESULT_INVALID; | 288 return HttpAuth::AUTHORIZATION_RESULT_INVALID; |
| 289 | 289 |
| 290 std::string encoded_auth_token = tok->base64_param(); | 290 std::string encoded_auth_token = tok->base64_param(); |
| 291 if (encoded_auth_token.empty()) { | 291 if (encoded_auth_token.empty()) { |
| 292 // If a context has already been established, an empty challenge | 292 // If a context has already been established, an empty challenge |
| 293 // should be treated as a rejection of the current attempt. | 293 // should be treated as a rejection of the current attempt. |
| 294 if (SecIsValidHandle(&ctxt_)) | 294 if (SecIsValidHandle(&ctxt_)) |
| 295 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 295 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
| 296 DCHECK(decoded_server_auth_token_.empty()); | 296 DCHECK(decoded_server_auth_token_.empty()); |
| 297 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; | 297 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 int token_length = pkg_info->cbMaxToken; | 473 int token_length = pkg_info->cbMaxToken; |
| 474 status = library->FreeContextBuffer(pkg_info); | 474 status = library->FreeContextBuffer(pkg_info); |
| 475 rv = MapFreeContextBufferStatusToError(status); | 475 rv = MapFreeContextBufferStatusToError(status); |
| 476 if (rv != OK) | 476 if (rv != OK) |
| 477 return rv; | 477 return rv; |
| 478 *max_token_length = token_length; | 478 *max_token_length = token_length; |
| 479 return OK; | 479 return OK; |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace net | 482 } // namespace net |
| OLD | NEW |