Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: remoting/protocol/me2me_host_authenticator_factory.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/string_util.h" 8 #include "base/strings/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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 } else { 123 } else {
124 // TODO(rmsousa): This only works for cases where the JID prefix matches 124 // TODO(rmsousa): This only works for cases where the JID prefix matches
125 // the host owner email. Figure out a way to verify the JID in other cases. 125 // the host owner email. Figure out a way to verify the JID in other cases.
126 remote_jid_prefix = host_owner_; 126 remote_jid_prefix = host_owner_;
127 } 127 }
128 128
129 // Verify that the client's jid is an ASCII string, and then check that the 129 // Verify that the client's jid is an ASCII string, and then check that the
130 // client JID has the expected prefix. Comparison is case insensitive. 130 // client JID has the expected prefix. Comparison is case insensitive.
131 if (!base::IsStringASCII(remote_jid) || 131 if (!base::IsStringASCII(remote_jid) ||
132 !StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) { 132 !base::StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) {
133 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid; 133 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid;
134 return make_scoped_ptr(new RejectingAuthenticator()); 134 return make_scoped_ptr(new RejectingAuthenticator());
135 } 135 }
136 136
137 if (!local_cert_.empty() && key_pair_.get()) { 137 if (!local_cert_.empty() && key_pair_.get()) {
138 if (token_validator_factory_) { 138 if (token_validator_factory_) {
139 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( 139 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth(
140 local_cert_, key_pair_, 140 local_cert_, key_pair_,
141 token_validator_factory_->CreateTokenValidator( 141 token_validator_factory_->CreateTokenValidator(
142 local_jid, remote_jid)); 142 local_jid, remote_jid));
143 } 143 }
144 144
145 return NegotiatingHostAuthenticator::CreateWithSharedSecret( 145 return NegotiatingHostAuthenticator::CreateWithSharedSecret(
146 local_cert_, key_pair_, shared_secret_hash_.value, 146 local_cert_, key_pair_, shared_secret_hash_.value,
147 shared_secret_hash_.hash_function, pairing_registry_); 147 shared_secret_hash_.hash_function, pairing_registry_);
148 } 148 }
149 149
150 return make_scoped_ptr(new RejectingAuthenticator()); 150 return make_scoped_ptr(new RejectingAuthenticator());
151 } 151 }
152 152
153 } // namespace protocol 153 } // namespace protocol
154 } // namespace remoting 154 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698