| 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_HOST_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_PAIRING_HOST_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 #include "remoting/protocol/pairing_registry.h" | 11 #include "remoting/protocol/pairing_registry.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | |
| 15 class RsaKeyPair; | |
| 16 | |
| 17 namespace protocol { | 14 namespace protocol { |
| 18 | 15 |
| 19 class PairingRegistry; | 16 class PairingRegistry; |
| 20 | 17 |
| 21 class PairingHostAuthenticator : public PairingAuthenticatorBase { | 18 class PairingHostAuthenticator : public PairingAuthenticatorBase { |
| 22 public: | 19 public: |
| 23 PairingHostAuthenticator( | 20 PairingHostAuthenticator( |
| 24 scoped_refptr<PairingRegistry> pairing_registry, | 21 scoped_refptr<PairingRegistry> pairing_registry, |
| 25 const std::string& local_cert, | 22 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, |
| 26 scoped_refptr<RsaKeyPair> key_pair, | |
| 27 const std::string& pin); | 23 const std::string& pin); |
| 28 ~PairingHostAuthenticator() override; | 24 ~PairingHostAuthenticator() override; |
| 29 | 25 |
| 30 // Authenticator interface. | 26 // Authenticator interface. |
| 31 State state() const override; | 27 State state() const override; |
| 32 RejectionReason rejection_reason() const override; | 28 RejectionReason rejection_reason() const override; |
| 33 void ProcessMessage(const buzz::XmlElement* message, | 29 void ProcessMessage(const buzz::XmlElement* message, |
| 34 const base::Closure& resume_callback) override; | 30 const base::Closure& resume_callback) override; |
| 35 | 31 |
| 36 private: | 32 private: |
| 37 // PairingAuthenticatorBase interface. | 33 // PairingAuthenticatorBase overrides. |
| 38 void CreateV2AuthenticatorWithPIN( | 34 void CreateSpakeAuthenticatorWithPin( |
| 39 State initial_state, | 35 State initial_state, |
| 40 const SetAuthenticatorCallback& callback) override; | 36 const base::Closure& resume_callback) override; |
| 41 void AddPairingElements(buzz::XmlElement* message) override; | 37 void AddPairingElements(buzz::XmlElement* message) override; |
| 42 | 38 |
| 43 // Continue processing a protocol message once the pairing information for | 39 // Continue processing a protocol message once the pairing information for |
| 44 // the client id has been received. | 40 // the client id has been received. |
| 45 void ProcessMessageWithPairing(const buzz::XmlElement* message, | 41 void ProcessMessageWithPairing(const buzz::XmlElement* message, |
| 46 const base::Closure& resume_callback, | 42 const base::Closure& resume_callback, |
| 47 PairingRegistry::Pairing pairing); | 43 PairingRegistry::Pairing pairing); |
| 48 | 44 |
| 49 // Protocol state. | 45 // Protocol state. |
| 50 scoped_refptr<PairingRegistry> pairing_registry_; | 46 scoped_refptr<PairingRegistry> pairing_registry_; |
| 51 std::string local_cert_; | 47 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; |
| 52 scoped_refptr<RsaKeyPair> key_pair_; | 48 std::string pin_; |
| 53 const std::string& pin_; | 49 bool protocol_error_ = false; |
| 54 bool protocol_error_; | 50 bool waiting_for_paired_secret_ = false; |
| 55 bool waiting_for_paired_secret_; | |
| 56 | 51 |
| 57 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_; | 52 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_; |
| 58 | 53 |
| 59 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator); | 54 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator); |
| 60 }; | 55 }; |
| 61 | 56 |
| 62 } // namespace protocol | 57 } // namespace protocol |
| 63 } // namespace remoting | 58 } // namespace remoting |
| 64 | 59 |
| 65 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ | 60 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ |
| OLD | NEW |