| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/protocol/me2me_host_authenticator_factory.h" | 5 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 size_t pos = client_username.find('/'); | 106 size_t pos = client_username.find('/'); |
| 107 if (pos != std::string::npos) { | 107 if (pos != std::string::npos) { |
| 108 client_username.replace(pos, std::string::npos, ""); | 108 client_username.replace(pos, std::string::npos, ""); |
| 109 } | 109 } |
| 110 if (!base::EndsWith(client_username, | 110 if (!base::EndsWith(client_username, |
| 111 std::string("@") + required_client_domain_, | 111 std::string("@") + required_client_domain_, |
| 112 base::CompareCase::INSENSITIVE_ASCII)) { | 112 base::CompareCase::INSENSITIVE_ASCII)) { |
| 113 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid | 113 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid |
| 114 << ": Domain mismatch."; | 114 << ": Domain mismatch."; |
| 115 return base::WrapUnique( | 115 return base::WrapUnique( |
| 116 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); | 116 new RejectingAuthenticator(Authenticator::INVALID_ACCOUNT)); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (!local_cert_.empty() && key_pair_.get()) { | 120 if (!local_cert_.empty() && key_pair_.get()) { |
| 121 std::string normalized_local_jid = NormalizeJid(local_jid); | 121 std::string normalized_local_jid = NormalizeJid(local_jid); |
| 122 std::string normalized_remote_jid = NormalizeJid(remote_jid); | 122 std::string normalized_remote_jid = NormalizeJid(remote_jid); |
| 123 | 123 |
| 124 if (token_validator_factory_) { | 124 if (token_validator_factory_) { |
| 125 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( | 125 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( |
| 126 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, | 126 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, |
| 127 token_validator_factory_); | 127 token_validator_factory_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 return NegotiatingHostAuthenticator::CreateWithSharedSecret( | 130 return NegotiatingHostAuthenticator::CreateWithSharedSecret( |
| 131 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, | 131 normalized_local_jid, normalized_remote_jid, local_cert_, key_pair_, |
| 132 pin_hash_, pairing_registry_); | 132 pin_hash_, pairing_registry_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 return base::WrapUnique( | 135 return base::WrapUnique( |
| 136 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); | 136 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace protocol | 139 } // namespace protocol |
| 140 } // namespace remoting | 140 } // namespace remoting |
| OLD | NEW |