| Index: remoting/protocol/it2me_host_authenticator_factory.cc
|
| diff --git a/remoting/protocol/it2me_host_authenticator_factory.cc b/remoting/protocol/it2me_host_authenticator_factory.cc
|
| index aad9f63dcf35b9c6255e799280ca2ca689095d37..87f09a1a139fd15583a8797ca0c0697da14b0969 100644
|
| --- a/remoting/protocol/it2me_host_authenticator_factory.cc
|
| +++ b/remoting/protocol/it2me_host_authenticator_factory.cc
|
| @@ -4,12 +4,15 @@
|
|
|
| #include "remoting/protocol/it2me_host_authenticator_factory.h"
|
|
|
| +#include <memory>
|
| +#include <string>
|
| +#include <utility>
|
| +
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| -#include "base/strings/string_util.h"
|
| #include "remoting/base/rsa_key_pair.h"
|
| #include "remoting/protocol/negotiating_host_authenticator.h"
|
| -#include "remoting/protocol/rejecting_authenticator.h"
|
| +#include "remoting/protocol/validating_authenticator.h"
|
|
|
| namespace remoting {
|
| namespace protocol {
|
| @@ -18,11 +21,11 @@ It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory(
|
| const std::string& local_cert,
|
| scoped_refptr<RsaKeyPair> key_pair,
|
| const std::string& access_code_hash,
|
| - const std::string& required_client_domain)
|
| + const ValidatingAuthenticator::ValidationCallback& callback)
|
| : local_cert_(local_cert),
|
| key_pair_(key_pair),
|
| access_code_hash_(access_code_hash),
|
| - required_client_domain_(required_client_domain) {}
|
| + validation_callback_(callback) {}
|
|
|
| It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() {}
|
|
|
| @@ -30,26 +33,13 @@ std::unique_ptr<Authenticator>
|
| It2MeHostAuthenticatorFactory::CreateAuthenticator(
|
| const std::string& local_jid,
|
| const std::string& remote_jid) {
|
| - // Check the client domain policy.
|
| - if (!required_client_domain_.empty()) {
|
| - std::string client_username = remote_jid;
|
| - size_t pos = client_username.find('/');
|
| - if (pos != std::string::npos) {
|
| - client_username.replace(pos, std::string::npos, "");
|
| - }
|
| - if (!base::EndsWith(client_username,
|
| - std::string("@") + required_client_domain_,
|
| - base::CompareCase::INSENSITIVE_ASCII)) {
|
| - LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
|
| - << ": Domain mismatch.";
|
| - return base::WrapUnique(
|
| - new RejectingAuthenticator(Authenticator::INVALID_ACCOUNT));
|
| - }
|
| - }
|
| -
|
| - return NegotiatingHostAuthenticator::CreateWithSharedSecret(
|
| - local_jid, remote_jid, local_cert_, key_pair_, access_code_hash_,
|
| - nullptr);
|
| + std::unique_ptr<Authenticator> authenticator(
|
| + NegotiatingHostAuthenticator::CreateWithSharedSecret(
|
| + local_jid, remote_jid, local_cert_, key_pair_, access_code_hash_,
|
| + nullptr));
|
| +
|
| + return base::MakeUnique<ValidatingAuthenticator>(
|
| + remote_jid, validation_callback_, std::move(authenticator));
|
| }
|
|
|
| } // namespace protocol
|
|
|