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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "remoting/base/rsa_key_pair.h" | 9 #include "remoting/base/rsa_key_pair.h" |
10 #include "remoting/protocol/channel_authenticator.h" | 10 #include "remoting/protocol/channel_authenticator.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Verify that the client's jid is an ASCII string, and then check | 116 // Verify that the client's jid is an ASCII string, and then check |
117 // that the client has the same bare jid as the host, i.e. client's | 117 // that the client has the same bare jid as the host, i.e. client's |
118 // full JID starts with host's bare jid. Comparison is case | 118 // full JID starts with host's bare jid. Comparison is case |
119 // insensitive. | 119 // insensitive. |
120 if (!IsStringASCII(remote_jid) || | 120 if (!IsStringASCII(remote_jid) || |
121 !StartsWithASCII(remote_jid, local_jid.substr(0, slash_pos + 1), false)) { | 121 !StartsWithASCII(remote_jid, local_jid.substr(0, slash_pos + 1), false)) { |
122 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid; | 122 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid; |
123 return scoped_ptr<Authenticator>(new RejectingAuthenticator()); | 123 return scoped_ptr<Authenticator>(new RejectingAuthenticator()); |
124 } | 124 } |
125 | 125 |
126 if (!local_cert_.empty() && key_pair_) { | 126 if (!local_cert_.empty() && key_pair_.get()) { |
127 if (token_validator_factory_) { | 127 if (token_validator_factory_) { |
128 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( | 128 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( |
129 local_cert_, key_pair_, | 129 local_cert_, key_pair_, |
130 token_validator_factory_->CreateTokenValidator( | 130 token_validator_factory_->CreateTokenValidator( |
131 local_jid, remote_jid)); | 131 local_jid, remote_jid)); |
132 } | 132 } |
133 | 133 |
134 return NegotiatingHostAuthenticator::CreateWithSharedSecret( | 134 return NegotiatingHostAuthenticator::CreateWithSharedSecret( |
135 local_cert_, key_pair_, shared_secret_hash_.value, | 135 local_cert_, key_pair_, shared_secret_hash_.value, |
136 shared_secret_hash_.hash_function, pairing_registry_); | 136 shared_secret_hash_.hash_function, pairing_registry_); |
137 } | 137 } |
138 | 138 |
139 return scoped_ptr<Authenticator>(new RejectingAuthenticator()); | 139 return scoped_ptr<Authenticator>(new RejectingAuthenticator()); |
140 } | 140 } |
141 | 141 |
142 } // namespace protocol | 142 } // namespace protocol |
143 } // namespace remoting | 143 } // namespace remoting |
OLD | NEW |