Index: remoting/protocol/negotiating_client_authenticator.cc |
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc |
index 11dd49abdeb0090cd7f011d544e921d904d2d06c..c6cda5d2d4e0d665209452ab17b3a2de416c0ab5 100644 |
--- a/remoting/protocol/negotiating_client_authenticator.cc |
+++ b/remoting/protocol/negotiating_client_authenticator.cc |
@@ -21,15 +21,20 @@ |
namespace remoting { |
namespace protocol { |
-ClientAuthenticationConfig::ClientAuthenticationConfig() {} |
-ClientAuthenticationConfig::~ClientAuthenticationConfig() {} |
- |
NegotiatingClientAuthenticator::NegotiatingClientAuthenticator( |
- const ClientAuthenticationConfig& config) |
+ const std::string& client_pairing_id, |
+ const std::string& shared_secret, |
+ const std::string& authentication_tag, |
+ const FetchSecretCallback& fetch_secret_callback, |
+ const FetchThirdPartyTokenCallback& fetch_third_party_token_callback) |
: NegotiatingAuthenticatorBase(MESSAGE_READY), |
- config_(config), |
+ client_pairing_id_(client_pairing_id), |
+ shared_secret_(shared_secret), |
+ authentication_tag_(authentication_tag), |
+ fetch_secret_callback_(fetch_secret_callback), |
+ fetch_third_party_token_callback_(fetch_third_party_token_callback), |
weak_factory_(this) { |
- if (!config_.fetch_third_party_token_callback.is_null()) |
+ if (!fetch_third_party_token_callback.is_null()) |
AddMethod(Method::THIRD_PARTY); |
AddMethod(Method::SPAKE2_PAIR); |
AddMethod(Method::SPAKE2_SHARED_SECRET_HMAC); |
@@ -110,7 +115,7 @@ |
if (current_method_ == Method::THIRD_PARTY) { |
current_authenticator_.reset(new ThirdPartyClientAuthenticator( |
base::Bind(&V2Authenticator::CreateForClient), |
- config_.fetch_third_party_token_callback)); |
+ fetch_third_party_token_callback_)); |
resume_callback.Run(); |
} else { |
DCHECK(current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN || |
@@ -120,20 +125,20 @@ |
SecretFetchedCallback callback = base::Bind( |
&NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret, |
weak_factory_.GetWeakPtr(), preferred_initial_state, resume_callback); |
- config_.fetch_secret_callback.Run(pairing_supported, callback); |
+ fetch_secret_callback_.Run(pairing_supported, callback); |
} |
} |
void NegotiatingClientAuthenticator::CreatePreferredAuthenticator() { |
- if (!config_.pairing_client_id.empty() && !config_.pairing_secret.empty() && |
+ if (!client_pairing_id_.empty() && !shared_secret_.empty() && |
std::find(methods_.begin(), methods_.end(), Method::SPAKE2_PAIR) != |
methods_.end()) { |
// If the client specified a pairing id and shared secret, then create a |
// PairingAuthenticator. |
current_authenticator_.reset(new PairingClientAuthenticator( |
- config_.pairing_client_id, config_.pairing_secret, |
- base::Bind(&V2Authenticator::CreateForClient), |
- config_.fetch_secret_callback, config_.host_id)); |
+ client_pairing_id_, shared_secret_, |
+ base::Bind(&V2Authenticator::CreateForClient), fetch_secret_callback_, |
+ authentication_tag_)); |
current_method_ = Method::SPAKE2_PAIR; |
} |
} |
@@ -145,7 +150,7 @@ |
current_authenticator_ = V2Authenticator::CreateForClient( |
(current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN) |
? shared_secret |
- : GetSharedSecretHash(config_.host_id, shared_secret), |
+ : GetSharedSecretHash(authentication_tag_, shared_secret), |
initial_state); |
resume_callback.Run(); |
} |