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

Unified Diff: remoting/protocol/me2me_host_authenticator_factory.cc

Issue 12313085: Host-side third party token validation (Closed) Base URL: http://git.chromium.org/chromium/src.git@third_party_auth_protocol
Patch Set: Add TODO comment Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/me2me_host_authenticator_factory.cc
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc
index 4ee7b65eff1aa1f202d3d0c80cde5ad143683576..5d908e77ca83095cb115a4c02c93a407627f335a 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.cc
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -58,13 +58,43 @@ class RejectingAuthenticator : public Authenticator {
} // namespace
-Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory(
+// static
+scoped_ptr<AuthenticatorFactory>
+Me2MeHostAuthenticatorFactory::CreateWithSharedSecret(
const std::string& local_cert,
scoped_refptr<RsaKeyPair> key_pair,
- const SharedSecretHash& shared_secret_hash)
- : local_cert_(local_cert),
- key_pair_(key_pair),
- shared_secret_hash_(shared_secret_hash) {
+ const SharedSecretHash& shared_secret_hash) {
+ scoped_ptr<Me2MeHostAuthenticatorFactory> result(
+ new Me2MeHostAuthenticatorFactory());
+ result->local_cert_ = local_cert;
+ result->key_pair_ = key_pair;
+ result->shared_secret_hash_ = shared_secret_hash;
+ return scoped_ptr<AuthenticatorFactory>(result.Pass());
+}
+
+
+// static
+scoped_ptr<AuthenticatorFactory>
+Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth(
+ const std::string& local_cert,
+ scoped_refptr<RsaKeyPair> key_pair,
+ scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory>
+ token_validator_factory) {
+ scoped_ptr<Me2MeHostAuthenticatorFactory> result(
+ new Me2MeHostAuthenticatorFactory());
+ result->local_cert_ = local_cert;
+ result->key_pair_ = key_pair;
+ result->token_validator_factory_ = token_validator_factory.Pass();
+ return scoped_ptr<AuthenticatorFactory>(result.Pass());
+}
+
+// static
+scoped_ptr<AuthenticatorFactory>
+ Me2MeHostAuthenticatorFactory::CreateRejecting() {
+ return scoped_ptr<AuthenticatorFactory>(new Me2MeHostAuthenticatorFactory());
+}
+
+Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() {
}
Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {
@@ -91,9 +121,20 @@ scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator(
return scoped_ptr<Authenticator>(new RejectingAuthenticator());
}
- return scoped_ptr<Authenticator>(new NegotiatingHostAuthenticator(
- local_cert_, key_pair_, shared_secret_hash_.value,
- shared_secret_hash_.hash_function));
+ if (!local_cert_.empty() && key_pair_) {
+ if (token_validator_factory_) {
+ return NegotiatingHostAuthenticator::CreateWithThirdPartyAuth(
+ local_cert_, key_pair_,
+ token_validator_factory_->CreateTokenValidator(
+ local_jid, remote_jid));
+ }
+
+ return NegotiatingHostAuthenticator::CreateWithSharedSecret(
+ local_cert_, key_pair_, shared_secret_hash_.value,
+ shared_secret_hash_.hash_function);
+ }
+
+ return scoped_ptr<Authenticator>(new RejectingAuthenticator());
}
} // namespace protocol
« no previous file with comments | « remoting/protocol/me2me_host_authenticator_factory.h ('k') | remoting/protocol/negotiating_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698