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