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 9a04d89742cbf5131e04b80ea1447619af5b5697..e41a09e93875ac6b9654a03d38a1508d1b9e4acf 100644 |
--- a/remoting/protocol/me2me_host_authenticator_factory.cc |
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc |
@@ -61,15 +61,25 @@ class RejectingAuthenticator : public Authenticator { |
Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory( |
const std::string& local_cert, |
scoped_refptr<RsaKeyPair> key_pair, |
- const SharedSecretHash& shared_secret_hash) |
+ const SharedSecretHash& shared_secret_hash, |
+ const GURL& token_url, |
+ const GURL& token_validation_url, |
+ ThirdPartyHostAuthenticator::TokenValidatorFactory* token_validator_factory) |
: local_cert_(local_cert), |
key_pair_(key_pair), |
- shared_secret_hash_(shared_secret_hash) { |
+ shared_secret_hash_(shared_secret_hash), |
+ token_url_(token_url), |
+ token_validation_url_(token_validation_url), |
+ token_validator_factory_(token_validator_factory) { |
} |
Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() { |
} |
+bool Me2MeHostAuthenticatorFactory::IsThirdPartyAuthenticationEnabled() const { |
+ return token_url_.is_valid() && token_validation_url_.is_valid() && key_pair_; |
+} |
+ |
scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( |
const std::string& local_jid, |
const std::string& remote_jid, |
@@ -91,7 +101,12 @@ scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( |
return scoped_ptr<Authenticator>(new RejectingAuthenticator()); |
} |
- return NegotiatingAuthenticator::CreateForHost( |
+ if (IsThirdPartyAuthenticationEnabled()) { |
+ return NegotiatingAuthenticator::CreateForHostThirdParty( |
+ local_cert_, key_pair_, token_url_, token_validation_url_, |
+ local_jid, remote_jid, token_validator_factory_); |
+ } |
+ return NegotiatingAuthenticator::CreateForHostSharedSecret( |
local_cert_, key_pair_, shared_secret_hash_.value, |
shared_secret_hash_.hash_function); |
} |