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

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

Issue 1769603005: Remove first_message argument from AuthenticatorFactory::Create(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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/it2me_host_authenticator_factory.h" 5 #include "remoting/protocol/it2me_host_authenticator_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.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/negotiating_host_authenticator.h" 10 #include "remoting/protocol/negotiating_host_authenticator.h"
11 #include "remoting/protocol/rejecting_authenticator.h" 11 #include "remoting/protocol/rejecting_authenticator.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 namespace protocol { 14 namespace protocol {
15 15
16 It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory( 16 It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory(
17 const std::string& local_cert, 17 const std::string& local_cert,
18 scoped_refptr<RsaKeyPair> key_pair, 18 scoped_refptr<RsaKeyPair> key_pair,
19 const std::string& access_code, 19 const std::string& access_code,
20 const std::string& required_client_domain) 20 const std::string& required_client_domain)
21 : local_cert_(local_cert), 21 : local_cert_(local_cert),
22 key_pair_(key_pair), 22 key_pair_(key_pair),
23 access_code_(access_code), 23 access_code_(access_code),
24 required_client_domain_(required_client_domain) {} 24 required_client_domain_(required_client_domain) {}
25 25
26 It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() {} 26 It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() {}
27 27
28 scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator( 28 scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator(
29 const std::string& local_jid, 29 const std::string& local_jid,
30 const std::string& remote_jid, 30 const std::string& remote_jid) {
31 const buzz::XmlElement* first_message) {
32 // Check the client domain policy. 31 // Check the client domain policy.
33 if (!required_client_domain_.empty()) { 32 if (!required_client_domain_.empty()) {
34 std::string client_username = remote_jid; 33 std::string client_username = remote_jid;
35 size_t pos = client_username.find('/'); 34 size_t pos = client_username.find('/');
36 if (pos != std::string::npos) { 35 if (pos != std::string::npos) {
37 client_username.replace(pos, std::string::npos, ""); 36 client_username.replace(pos, std::string::npos, "");
38 } 37 }
39 if (!base::EndsWith(client_username, 38 if (!base::EndsWith(client_username,
40 std::string("@") + required_client_domain_, 39 std::string("@") + required_client_domain_,
41 base::CompareCase::INSENSITIVE_ASCII)) { 40 base::CompareCase::INSENSITIVE_ASCII)) {
42 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid 41 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
43 << ": Domain mismatch."; 42 << ": Domain mismatch.";
44 return make_scoped_ptr( 43 return make_scoped_ptr(
45 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); 44 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
46 } 45 }
47 } 46 }
48 47
49 return NegotiatingHostAuthenticator::CreateForIt2Me(local_cert_, key_pair_, 48 return NegotiatingHostAuthenticator::CreateForIt2Me(local_cert_, key_pair_,
50 access_code_); 49 access_code_);
51 } 50 }
52 51
53 } // namespace protocol 52 } // namespace protocol
54 } // namespace remoting 53 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/it2me_host_authenticator_factory.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698