| 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 // and "NTLM Security Support Provider" at | 7 // and "NTLM Security Support Provider" at |
| 8 // http://msdn.microsoft.com/en-us/library/aa923611.aspx. | 8 // http://msdn.microsoft.com/en-us/library/aa923611.aspx. |
| 9 | 9 |
| 10 #include "net/http/http_auth_handler_ntlm.h" | 10 #include "net/http/http_auth_handler_ntlm.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 HttpAuthHandlerNTLM::Factory::Factory() | 45 HttpAuthHandlerNTLM::Factory::Factory() |
| 46 : max_token_length_(0), | 46 : max_token_length_(0), |
| 47 is_unsupported_(false) { | 47 is_unsupported_(false) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 HttpAuthHandlerNTLM::Factory::~Factory() { | 50 HttpAuthHandlerNTLM::Factory::~Factory() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( | 53 int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( |
| 54 HttpAuthChallengeTokenizer* challenge, | 54 const HttpAuthChallengeTokenizer& challenge, |
| 55 HttpAuth::Target target, | 55 HttpAuth::Target target, |
| 56 const GURL& origin, | 56 const GURL& origin, |
| 57 CreateReason reason, | 57 CreateReason reason, |
| 58 int digest_nonce_count, | 58 int digest_nonce_count, |
| 59 const BoundNetLog& net_log, | 59 const BoundNetLog& net_log, |
| 60 scoped_ptr<HttpAuthHandler>* handler) { | 60 scoped_ptr<HttpAuthHandler>* handler) { |
| 61 if (is_unsupported_ || reason == CREATE_PREEMPTIVE) | 61 if (is_unsupported_ || reason == CREATE_PREEMPTIVE) |
| 62 return ERR_UNSUPPORTED_AUTH_SCHEME; | 62 return ERR_UNSUPPORTED_AUTH_SCHEME; |
| 63 if (max_token_length_ == 0) { | 63 if (max_token_length_ == 0) { |
| 64 int rv = DetermineMaxTokenLength(sspi_library_.get(), NTLMSP_NAME, | 64 int rv = DetermineMaxTokenLength(sspi_library_.get(), NTLMSP_NAME, |
| 65 &max_token_length_); | 65 &max_token_length_); |
| 66 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) | 66 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) |
| 67 is_unsupported_ = true; | 67 is_unsupported_ = true; |
| 68 if (rv != OK) | 68 if (rv != OK) |
| 69 return rv; | 69 return rv; |
| 70 } | 70 } |
| 71 // TODO(cbentzel): Move towards model of parsing in the factory | 71 // TODO(cbentzel): Move towards model of parsing in the factory |
| 72 // method and only constructing when valid. | 72 // method and only constructing when valid. |
| 73 scoped_ptr<HttpAuthHandler> tmp_handler( | 73 scoped_ptr<HttpAuthHandler> tmp_handler( |
| 74 new HttpAuthHandlerNTLM(sspi_library_.get(), max_token_length_, | 74 new HttpAuthHandlerNTLM(sspi_library_.get(), max_token_length_, |
| 75 url_security_manager())); | 75 url_security_manager())); |
| 76 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 76 int result = |
| 77 return ERR_INVALID_RESPONSE; | 77 tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log); |
| 78 handler->swap(tmp_handler); | 78 if (result == OK) |
| 79 return OK; | 79 handler->swap(tmp_handler); |
| 80 return result; |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace net | 83 } // namespace net |
| OLD | NEW |