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

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

Issue 1788443005: Make TokenValidatorFactory ref-counted. (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/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 30 matching lines...) Expand all
41 } 41 }
42 42
43 43
44 // static 44 // static
45 scoped_ptr<AuthenticatorFactory> 45 scoped_ptr<AuthenticatorFactory>
46 Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( 46 Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth(
47 bool use_service_account, 47 bool use_service_account,
48 const std::string& host_owner, 48 const std::string& host_owner,
49 const std::string& local_cert, 49 const std::string& local_cert,
50 scoped_refptr<RsaKeyPair> key_pair, 50 scoped_refptr<RsaKeyPair> key_pair,
51 const std::string& required_client_domain, 51 const std::string& required_client_domain,
52 scoped_ptr<TokenValidatorFactory> 52 scoped_refptr<TokenValidatorFactory> token_validator_factory) {
53 token_validator_factory) {
54 scoped_ptr<Me2MeHostAuthenticatorFactory> result( 53 scoped_ptr<Me2MeHostAuthenticatorFactory> result(
55 new Me2MeHostAuthenticatorFactory()); 54 new Me2MeHostAuthenticatorFactory());
56 result->use_service_account_ = use_service_account; 55 result->use_service_account_ = use_service_account;
57 result->host_owner_ = host_owner; 56 result->host_owner_ = host_owner;
58 result->local_cert_ = local_cert; 57 result->local_cert_ = local_cert;
59 result->key_pair_ = key_pair; 58 result->key_pair_ = key_pair;
60 result->required_client_domain_ = required_client_domain; 59 result->required_client_domain_ = required_client_domain;
61 result->token_validator_factory_ = std::move(token_validator_factory); 60 result->token_validator_factory_ = token_validator_factory;
62 return std::move(result); 61 return std::move(result);
63 } 62 }
64 63
65 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() {} 64 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() {}
66 65
67 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {} 66 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {}
68 67
69 scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( 68 scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator(
70 const std::string& local_jid, 69 const std::string& local_jid,
71 const std::string& remote_jid) { 70 const std::string& remote_jid) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 << ": Domain mismatch."; 112 << ": Domain mismatch.";
114 return make_scoped_ptr( 113 return make_scoped_ptr(
115 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); 114 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
116 } 115 }
117 } 116 }
118 117
119 if (!local_cert_.empty() && key_pair_.get()) { 118 if (!local_cert_.empty() && key_pair_.get()) {
120 if (token_validator_factory_) { 119 if (token_validator_factory_) {
121 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( 120 return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth(
122 local_jid, remote_jid, local_cert_, key_pair_, 121 local_jid, remote_jid, local_cert_, key_pair_,
123 token_validator_factory_->CreateTokenValidator(local_jid, 122 token_validator_factory_);
124 remote_jid));
125 } 123 }
126 124
127 return NegotiatingHostAuthenticator::CreateWithPin( 125 return NegotiatingHostAuthenticator::CreateWithPin(
128 local_jid, remote_jid, local_cert_, key_pair_, pin_hash_, 126 local_jid, remote_jid, local_cert_, key_pair_, pin_hash_,
129 pairing_registry_); 127 pairing_registry_);
130 } 128 }
131 129
132 return make_scoped_ptr( 130 return make_scoped_ptr(
133 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS)); 131 new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
134 } 132 }
135 133
136 } // namespace protocol 134 } // namespace protocol
137 } // namespace remoting 135 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/me2me_host_authenticator_factory.h ('k') | remoting/protocol/negotiating_host_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698