| 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/client_authentication_config.h" |
| 10 #include "remoting/protocol/pairing_authenticator_base.h" | 11 #include "remoting/protocol/pairing_authenticator_base.h" |
| 11 | 12 |
| 12 namespace remoting { | 13 namespace remoting { |
| 13 namespace protocol { | 14 namespace protocol { |
| 14 | 15 |
| 15 class PairingClientAuthenticator : public PairingAuthenticatorBase { | 16 class PairingClientAuthenticator : public PairingAuthenticatorBase { |
| 16 public: | 17 public: |
| 17 PairingClientAuthenticator( | 18 PairingClientAuthenticator( |
| 18 const std::string& client_id, | 19 const ClientAuthenticationConfig& client_auth_config, |
| 19 const std::string& paired_secret, | 20 const CreateBaseAuthenticatorCallback& |
| 20 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, | 21 create_base_authenticator_callback); |
| 21 const FetchSecretCallback& fetch_pin_callback, | |
| 22 const std::string& host_id); | |
| 23 ~PairingClientAuthenticator() override; | 22 ~PairingClientAuthenticator() override; |
| 24 | 23 |
| 25 // Authenticator interface. | 24 // Authenticator interface. |
| 26 State state() const override; | 25 State state() const override; |
| 27 | 26 |
| 28 private: | 27 private: |
| 29 // PairingAuthenticatorBase overrides. | 28 // PairingAuthenticatorBase overrides. |
| 30 void CreateSpakeAuthenticatorWithPin( | 29 void CreateSpakeAuthenticatorWithPin( |
| 31 State initial_state, | 30 State initial_state, |
| 32 const base::Closure& resume_callback) override; | 31 const base::Closure& resume_callback) override; |
| 33 void AddPairingElements(buzz::XmlElement* message) override; | 32 void AddPairingElements(buzz::XmlElement* message) override; |
| 34 | 33 |
| 35 void OnPinFetched(State initial_state, | 34 void OnPinFetched(State initial_state, |
| 36 const base::Closure& resume_callback, | 35 const base::Closure& resume_callback, |
| 37 const std::string& pin); | 36 const std::string& pin); |
| 38 | 37 |
| 39 // Protocol state. | 38 ClientAuthenticationConfig client_auth_config_; |
| 39 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; |
| 40 |
| 41 // Set to true after client_id is sent to the host. |
| 40 bool sent_client_id_ = false; | 42 bool sent_client_id_ = false; |
| 41 std::string client_id_; | |
| 42 std::string paired_secret_; | |
| 43 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; | |
| 44 FetchSecretCallback fetch_pin_callback_; | |
| 45 std::string host_id_; | |
| 46 | 43 |
| 47 // Set to true if a PIN-based authenticator has been requested but has not | 44 // Set to true if a PIN-based authenticator has been requested but has not |
| 48 // yet been set. | 45 // yet been set. |
| 49 bool waiting_for_pin_ = false; | 46 bool waiting_for_pin_ = false; |
| 50 | 47 |
| 51 base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_; | 48 base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_; |
| 52 | 49 |
| 53 DISALLOW_COPY_AND_ASSIGN(PairingClientAuthenticator); | 50 DISALLOW_COPY_AND_ASSIGN(PairingClientAuthenticator); |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 } // namespace protocol | 53 } // namespace protocol |
| 57 } // namespace remoting | 54 } // namespace remoting |
| 58 | 55 |
| 59 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ | 56 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ |
| OLD | NEW |