OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/http/http_auth_gssapi_posix.h" | 5 #include "net/http/http_auth_gssapi_posix.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 std::string decoded_auth_token; | 714 std::string decoded_auth_token; |
715 bool base64_rv = base::Base64Decode(encoded_auth_token, &decoded_auth_token); | 715 bool base64_rv = base::Base64Decode(encoded_auth_token, &decoded_auth_token); |
716 if (!base64_rv) { | 716 if (!base64_rv) { |
717 LOG(ERROR) << "Base64 decoding of auth token failed."; | 717 LOG(ERROR) << "Base64 decoding of auth token failed."; |
718 return false; | 718 return false; |
719 } | 719 } |
720 decoded_server_auth_token_ = decoded_auth_token; | 720 decoded_server_auth_token_ = decoded_auth_token; |
721 return true; | 721 return true; |
722 } | 722 } |
723 | 723 |
724 int HttpAuthGSSAPI::GenerateAuthToken(const std::wstring* username, | 724 int HttpAuthGSSAPI::GenerateAuthToken(const string16* username, |
725 const std::wstring* password, | 725 const string16* password, |
726 const std::wstring& spn, | 726 const std::wstring& spn, |
727 std::string* auth_token) { | 727 std::string* auth_token) { |
728 DCHECK(auth_token); | 728 DCHECK(auth_token); |
729 DCHECK((username == NULL) == (password == NULL)); | 729 DCHECK((username == NULL) == (password == NULL)); |
730 | 730 |
731 if (!IsFinalRound()) { | 731 if (!IsFinalRound()) { |
732 int rv = OnFirstRound(username, password); | 732 int rv = OnFirstRound(username, password); |
733 if (rv != OK) | 733 if (rv != OK) |
734 return rv; | 734 return rv; |
735 } | 735 } |
(...skipping 14 matching lines...) Expand all Loading... |
750 std::string encode_input(static_cast<char*>(output_token.value), | 750 std::string encode_input(static_cast<char*>(output_token.value), |
751 output_token.length); | 751 output_token.length); |
752 std::string encode_output; | 752 std::string encode_output; |
753 bool ok = base::Base64Encode(encode_input, &encode_output); | 753 bool ok = base::Base64Encode(encode_input, &encode_output); |
754 if (!ok) | 754 if (!ok) |
755 return ERR_UNEXPECTED; | 755 return ERR_UNEXPECTED; |
756 *auth_token = scheme_ + " " + encode_output; | 756 *auth_token = scheme_ + " " + encode_output; |
757 return OK; | 757 return OK; |
758 } | 758 } |
759 | 759 |
760 int HttpAuthGSSAPI::OnFirstRound(const std::wstring* username, | 760 int HttpAuthGSSAPI::OnFirstRound(const string16* username, |
761 const std::wstring* password) { | 761 const string16* password) { |
762 // TODO(cbentzel): Acquire credentials? | 762 // TODO(cbentzel): Acquire credentials? |
763 DCHECK((username == NULL) == (password == NULL)); | 763 DCHECK((username == NULL) == (password == NULL)); |
764 username_.clear(); | 764 username_.clear(); |
765 password_.clear(); | 765 password_.clear(); |
766 if (username) { | 766 if (username) { |
767 username_ = *username; | 767 username_ = *username; |
768 password_ = *password; | 768 password_ = *password; |
769 } | 769 } |
770 return OK; | 770 return OK; |
771 } | 771 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 minor_status) | 822 minor_status) |
823 << std::endl | 823 << std::endl |
824 << DescribeContext(library_, scoped_sec_context_.get()); | 824 << DescribeContext(library_, scoped_sec_context_.get()); |
825 return ERR_MISSING_AUTH_CREDENTIALS; | 825 return ERR_MISSING_AUTH_CREDENTIALS; |
826 } | 826 } |
827 | 827 |
828 return OK; | 828 return OK; |
829 } | 829 } |
830 | 830 |
831 } // namespace net | 831 } // namespace net |
OLD | NEW |