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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 new Me2MeHostAuthenticatorFactory()); | 55 new Me2MeHostAuthenticatorFactory()); |
56 result->use_service_account_ = use_service_account; | 56 result->use_service_account_ = use_service_account; |
57 result->host_owner_ = host_owner; | 57 result->host_owner_ = host_owner; |
58 result->local_cert_ = local_cert; | 58 result->local_cert_ = local_cert; |
59 result->key_pair_ = key_pair; | 59 result->key_pair_ = key_pair; |
60 result->required_client_domain_ = required_client_domain; | 60 result->required_client_domain_ = required_client_domain; |
61 result->token_validator_factory_ = std::move(token_validator_factory); | 61 result->token_validator_factory_ = std::move(token_validator_factory); |
62 return std::move(result); | 62 return std::move(result); |
63 } | 63 } |
64 | 64 |
65 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() { | 65 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() {} |
66 } | |
67 | 66 |
68 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() { | 67 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {} |
69 } | |
70 | 68 |
71 scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( | 69 scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( |
72 const std::string& local_jid, | 70 const std::string& local_jid, |
73 const std::string& remote_jid, | 71 const std::string& remote_jid) { |
74 const buzz::XmlElement* first_message) { | |
75 | 72 |
76 std::string remote_jid_prefix; | 73 std::string remote_jid_prefix; |
77 | 74 |
78 if (!use_service_account_) { | 75 if (!use_service_account_) { |
79 // JID prefixes may not match the host owner email, for example, in cases | 76 // JID prefixes may not match the host owner email, for example, in cases |
80 // where the host owner account does not have an email associated with it. | 77 // where the host owner account does not have an email associated with it. |
81 // In those cases, the only guarantee we have is that JIDs for the same | 78 // In those cases, the only guarantee we have is that JIDs for the same |
82 // account will have the same prefix. | 79 // account will have the same prefix. |
83 if (!SplitJidResource(local_jid, &remote_jid_prefix, nullptr)) { | 80 if (!SplitJidResource(local_jid, &remote_jid_prefix, nullptr)) { |
84 LOG(DFATAL) << "Invalid local JID:" << local_jid; | 81 LOG(DFATAL) << "Invalid local JID:" << local_jid; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return NegotiatingHostAuthenticator::CreateWithPin( | 127 return NegotiatingHostAuthenticator::CreateWithPin( |
131 local_cert_, key_pair_, pin_hash_, pairing_registry_); | 128 local_cert_, key_pair_, pin_hash_, pairing_registry_); |
132 } | 129 } |
133 | 130 |
134 return make_scoped_ptr( | 131 return make_scoped_ptr( |
135 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); | 132 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); |
136 } | 133 } |
137 | 134 |
138 } // namespace protocol | 135 } // namespace protocol |
139 } // namespace remoting | 136 } // namespace remoting |
OLD | NEW |