| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return ERR_OUT_OF_MEMORY; | 353 return ERR_OUT_OF_MEMORY; |
| 354 | 354 |
| 355 DWORD context_flags = 0; | 355 DWORD context_flags = 0; |
| 356 // Firefox only sets ISC_REQ_DELEGATE, but MSDN documentation indicates that | 356 // Firefox only sets ISC_REQ_DELEGATE, but MSDN documentation indicates that |
| 357 // ISC_REQ_MUTUAL_AUTH must also be set. | 357 // ISC_REQ_MUTUAL_AUTH must also be set. |
| 358 if (can_delegate_) | 358 if (can_delegate_) |
| 359 context_flags |= (ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH); | 359 context_flags |= (ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH); |
| 360 | 360 |
| 361 // This returns a token that is passed to the remote server. | 361 // This returns a token that is passed to the remote server. |
| 362 DWORD context_attribute; | 362 DWORD context_attribute; |
| 363 std::wstring spn_wide = base::ASCIIToWide(spn); | 363 base::string16 spn16 = base::ASCIIToUTF16(spn); |
| 364 SECURITY_STATUS status = library_->InitializeSecurityContext( | 364 SECURITY_STATUS status = library_->InitializeSecurityContext( |
| 365 &cred_, // phCredential | 365 &cred_, // phCredential |
| 366 ctxt_ptr, // phContext | 366 ctxt_ptr, // phContext |
| 367 const_cast<wchar_t *>(spn_wide.c_str()), // pszTargetName | 367 const_cast<base::char16*>(spn16.c_str()), // pszTargetName |
| 368 context_flags, // fContextReq | 368 context_flags, // fContextReq |
| 369 0, // Reserved1 (must be 0) | 369 0, // Reserved1 (must be 0) |
| 370 SECURITY_NATIVE_DREP, // TargetDataRep | 370 SECURITY_NATIVE_DREP, // TargetDataRep |
| 371 in_buffer_desc_ptr, // pInput | 371 in_buffer_desc_ptr, // pInput |
| 372 0, // Reserved2 (must be 0) | 372 0, // Reserved2 (must be 0) |
| 373 &ctxt_, // phNewContext | 373 &ctxt_, // phNewContext |
| 374 &out_buffer_desc, // pOutput | 374 &out_buffer_desc, // pOutput |
| 375 &context_attribute, // pfContextAttr | 375 &context_attribute, // pfContextAttr |
| 376 NULL); // ptsExpiry | 376 NULL); // ptsExpiry |
| 377 int rv = MapInitializeSecurityContextStatusToError(status); | 377 int rv = MapInitializeSecurityContextStatusToError(status); |
| (...skipping 41 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 |