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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void HttpAuthSSPI::ResetSecurityContext() { | 222 void HttpAuthSSPI::ResetSecurityContext() { |
223 if (SecIsValidHandle(&ctxt_)) { | 223 if (SecIsValidHandle(&ctxt_)) { |
224 library_->DeleteSecurityContext(&ctxt_); | 224 library_->DeleteSecurityContext(&ctxt_); |
225 SecInvalidateHandle(&ctxt_); | 225 SecInvalidateHandle(&ctxt_); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( | 229 HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( |
230 HttpAuthChallengeTokenizer* tok) { | 230 HttpAuthChallengeTokenizer* tok) { |
231 // Verify the challenge's auth-scheme. | 231 // Verify the challenge's auth-scheme. |
232 if (!LowerCaseEqualsASCII(tok->scheme(), | 232 if (!base::LowerCaseEqualsASCII(tok->scheme(), |
233 base::StringToLowerASCII(scheme_).c_str())) | 233 base::StringToLowerASCII(scheme_).c_str())) |
234 return HttpAuth::AUTHORIZATION_RESULT_INVALID; | 234 return HttpAuth::AUTHORIZATION_RESULT_INVALID; |
235 | 235 |
236 std::string encoded_auth_token = tok->base64_param(); | 236 std::string encoded_auth_token = tok->base64_param(); |
237 if (encoded_auth_token.empty()) { | 237 if (encoded_auth_token.empty()) { |
238 // If a context has already been established, an empty challenge | 238 // If a context has already been established, an empty challenge |
239 // should be treated as a rejection of the current attempt. | 239 // should be treated as a rejection of the current attempt. |
240 if (SecIsValidHandle(&ctxt_)) | 240 if (SecIsValidHandle(&ctxt_)) |
241 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 241 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
242 DCHECK(decoded_server_auth_token_.empty()); | 242 DCHECK(decoded_server_auth_token_.empty()); |
243 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; | 243 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 int token_length = pkg_info->cbMaxToken; | 419 int token_length = pkg_info->cbMaxToken; |
420 status = library->FreeContextBuffer(pkg_info); | 420 status = library->FreeContextBuffer(pkg_info); |
421 rv = MapFreeContextBufferStatusToError(status); | 421 rv = MapFreeContextBufferStatusToError(status); |
422 if (rv != OK) | 422 if (rv != OK) |
423 return rv; | 423 return rv; |
424 *max_token_length = token_length; | 424 *max_token_length = token_length; |
425 return OK; | 425 return OK; |
426 } | 426 } |
427 | 427 |
428 } // namespace net | 428 } // namespace net |
OLD | NEW |