| Index: remoting/protocol/pairing_client_authenticator.cc
|
| diff --git a/remoting/protocol/pairing_client_authenticator.cc b/remoting/protocol/pairing_client_authenticator.cc
|
| index b70e0c6a06fbf41effee5a641011185e9256f8db..b35e7fbf42725971d52e0d6993b653f880cd9e11 100644
|
| --- a/remoting/protocol/pairing_client_authenticator.cc
|
| +++ b/remoting/protocol/pairing_client_authenticator.cc
|
| @@ -19,14 +19,34 @@ PairingClientAuthenticator::PairingClientAuthenticator(
|
| const CreateBaseAuthenticatorCallback& create_base_authenticator_callback)
|
| : client_auth_config_(client_auth_config),
|
| create_base_authenticator_callback_(create_base_authenticator_callback),
|
| - weak_factory_(this) {
|
| - spake2_authenticator_ = create_base_authenticator_callback_.Run(
|
| - client_auth_config.pairing_secret, MESSAGE_READY);
|
| - using_paired_secret_ = true;
|
| -}
|
| + weak_factory_(this) {}
|
|
|
| PairingClientAuthenticator::~PairingClientAuthenticator() {}
|
|
|
| +void PairingClientAuthenticator::Start(State initial_state,
|
| + const base::Closure& resume_callback) {
|
| + if (client_auth_config_.pairing_client_id.empty() ||
|
| + client_auth_config_.pairing_secret.empty()) {
|
| + // Send pairing error to make it clear that PIN is being used instead of
|
| + // pairing secret.
|
| + error_message_ = "not-paired";
|
| + using_paired_secret_ = false;
|
| + CreateSpakeAuthenticatorWithPin(initial_state, resume_callback);
|
| + } else {
|
| + StartPaired(initial_state);
|
| + resume_callback.Run();
|
| + }
|
| +}
|
| +
|
| +void PairingClientAuthenticator::StartPaired(State initial_state) {
|
| + DCHECK(!client_auth_config_.pairing_client_id.empty());
|
| + DCHECK(!client_auth_config_.pairing_secret.empty());
|
| +
|
| + using_paired_secret_ = true;
|
| + spake2_authenticator_ = create_base_authenticator_callback_.Run(
|
| + client_auth_config_.pairing_secret, initial_state);
|
| +}
|
| +
|
| Authenticator::State PairingClientAuthenticator::state() const {
|
| if (waiting_for_pin_)
|
| return PROCESSING_MESSAGE;
|
| @@ -44,20 +64,6 @@ void PairingClientAuthenticator::CreateSpakeAuthenticatorWithPin(
|
| weak_factory_.GetWeakPtr(), initial_state, resume_callback));
|
| }
|
|
|
| -void PairingClientAuthenticator::AddPairingElements(buzz::XmlElement* message) {
|
| - // If the client id and secret have not yet been sent, do so now. Note that
|
| - // in this case the V2Authenticator is being used optimistically to send the
|
| - // first message of the SPAKE exchange since we don't yet know whether or not
|
| - // the host will accept the client id or request that we fall back to the PIN.
|
| - if (!sent_client_id_) {
|
| - buzz::XmlElement* pairing_tag = new buzz::XmlElement(kPairingInfoTag);
|
| - pairing_tag->AddAttr(kClientIdAttribute,
|
| - client_auth_config_.pairing_client_id);
|
| - message->AddElement(pairing_tag);
|
| - sent_client_id_ = true;
|
| - }
|
| -}
|
| -
|
| void PairingClientAuthenticator::OnPinFetched(
|
| State initial_state,
|
| const base::Closure& resume_callback,
|
|
|