| 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 754ace6e7cba84a5e045b85ec0b1043161633afd..b9251c9831e1f1b2cbf6fcf7cbe81ef16cd7c641 100644
|
| --- a/remoting/protocol/me2me_host_authenticator_factory.cc
|
| +++ b/remoting/protocol/me2me_host_authenticator_factory.cc
|
| @@ -59,10 +59,18 @@ class RejectingAuthenticator : public Authenticator {
|
| Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory(
|
| const std::string& local_cert,
|
| scoped_ptr<KeyPair> key_pair,
|
| - const SharedSecretHash& shared_secret_hash)
|
| + const SharedSecretHash& shared_secret_hash,
|
| + const std::string& third_party_token_url,
|
| + const std::string& third_party_token_validation_url,
|
| + ThirdPartyAuthenticator::TokenValidatorFactory*
|
| + third_party_token_validator_factory)
|
| : local_cert_(local_cert),
|
| key_pair_(key_pair.Pass()),
|
| - shared_secret_hash_(shared_secret_hash) {
|
| + shared_secret_hash_(shared_secret_hash),
|
| + third_party_token_url_(third_party_token_url),
|
| + third_party_token_validation_url_(third_party_token_validation_url),
|
| + third_party_token_validator_factory_(third_party_token_validator_factory)
|
| +{
|
| }
|
|
|
| Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {
|
| @@ -89,9 +97,20 @@ scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator(
|
| return scoped_ptr<Authenticator>(new RejectingAuthenticator());
|
| }
|
|
|
| - return NegotiatingAuthenticator::CreateForHost(
|
| - local_cert_, key_pair_->Copy(), shared_secret_hash_.value,
|
| - shared_secret_hash_.hash_function);
|
| + if (third_party_token_url_.empty() ||
|
| + third_party_token_validation_url_.empty() ||
|
| + third_party_token_validator_factory_ == NULL) {
|
| + return NegotiatingAuthenticator::CreateForHostSharedSecret(
|
| + local_cert_, key_pair_->Copy(), shared_secret_hash_.value,
|
| + shared_secret_hash_.hash_function);
|
| + } else {
|
| + std::string third_party_token_scope =
|
| + "client:" + remote_jid + " host:" + local_jid;
|
| + return NegotiatingAuthenticator::CreateForHostThirdPartyAuth(
|
| + local_cert_, key_pair_->Copy(), third_party_token_url_,
|
| + third_party_token_validation_url_, third_party_token_scope,
|
| + third_party_token_validator_factory_);
|
| + }
|
| }
|
|
|
| } // namespace protocol
|
|
|