| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "remoting/protocol/pairing_authenticator_base.h" | 10 #include "remoting/protocol/pairing_authenticator_base.h" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 namespace protocol { | 13 namespace protocol { |
| 14 | 14 |
| 15 class PairingClientAuthenticator : public PairingAuthenticatorBase { | 15 class PairingClientAuthenticator : public PairingAuthenticatorBase { |
| 16 public: | 16 public: |
| 17 PairingClientAuthenticator( | 17 PairingClientAuthenticator( |
| 18 const std::string& client_id, | 18 const std::string& client_id, |
| 19 const std::string& paired_secret, | 19 const std::string& paired_secret, |
| 20 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, |
| 20 const FetchSecretCallback& fetch_pin_callback, | 21 const FetchSecretCallback& fetch_pin_callback, |
| 21 const std::string& authentication_tag); | 22 const std::string& authentication_tag); |
| 22 ~PairingClientAuthenticator() override; | 23 ~PairingClientAuthenticator() override; |
| 23 | 24 |
| 25 // Authenticator interface. |
| 26 State state() const override; |
| 27 |
| 24 private: | 28 private: |
| 25 // PairingAuthenticatorBase interface. | 29 // PairingAuthenticatorBase overrides. |
| 26 void CreateV2AuthenticatorWithPIN( | 30 void CreateSpakeAuthenticatorWithPin( |
| 27 State initial_state, | 31 State initial_state, |
| 28 const SetAuthenticatorCallback& callback) override; | 32 const base::Closure& resume_callback) override; |
| 29 void AddPairingElements(buzz::XmlElement* message) override; | 33 void AddPairingElements(buzz::XmlElement* message) override; |
| 30 | 34 |
| 31 void OnPinFetched(State initial_state, | 35 void OnPinFetched(State initial_state, |
| 32 const SetAuthenticatorCallback& callback, | 36 const base::Closure& resume_callback, |
| 33 const std::string& pin); | 37 const std::string& pin); |
| 34 | 38 |
| 35 // Protocol state. | 39 // Protocol state. |
| 36 bool sent_client_id_; | 40 bool sent_client_id_ = false; |
| 37 std::string client_id_; | 41 std::string client_id_; |
| 38 const std::string& paired_secret_; | 42 std::string paired_secret_; |
| 43 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; |
| 39 FetchSecretCallback fetch_pin_callback_; | 44 FetchSecretCallback fetch_pin_callback_; |
| 40 std::string authentication_tag_; | 45 std::string authentication_tag_; |
| 41 | 46 |
| 47 // Set to true if a PIN-based authenticator has been requested but has not |
| 48 // yet been set. |
| 49 bool waiting_for_pin_ = false; |
| 50 |
| 42 base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_; | 51 base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_; |
| 43 | 52 |
| 44 DISALLOW_COPY_AND_ASSIGN(PairingClientAuthenticator); | 53 DISALLOW_COPY_AND_ASSIGN(PairingClientAuthenticator); |
| 45 }; | 54 }; |
| 46 | 55 |
| 47 } // namespace protocol | 56 } // namespace protocol |
| 48 } // namespace remoting | 57 } // namespace remoting |
| 49 | 58 |
| 50 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ | 59 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ |
| OLD | NEW |