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_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "remoting/protocol/authenticator.h" | 14 #include "remoting/protocol/authenticator.h" |
15 #include "remoting/protocol/negotiating_authenticator_base.h" | 15 #include "remoting/protocol/negotiating_authenticator_base.h" |
16 #include "remoting/protocol/pairing_registry.h" | 16 #include "remoting/protocol/pairing_registry.h" |
17 #include "remoting/protocol/third_party_host_authenticator.h" | 17 #include "remoting/protocol/third_party_host_authenticator.h" |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class RsaKeyPair; | 21 class RsaKeyPair; |
22 | 22 |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
| 25 class TokenValidatorFactory; |
| 26 |
25 // Host-side implementation of NegotiatingAuthenticatorBase. | 27 // Host-side implementation of NegotiatingAuthenticatorBase. |
26 // See comments in negotiating_authenticator_base.h for a general explanation. | 28 // See comments in negotiating_authenticator_base.h for a general explanation. |
27 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { | 29 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { |
28 public: | 30 public: |
29 ~NegotiatingHostAuthenticator() override; | 31 ~NegotiatingHostAuthenticator() override; |
30 | 32 |
31 // Creates a host authenticator for It2Me host. | 33 // Creates a host authenticator for It2Me host. |
32 static scoped_ptr<Authenticator> CreateForIt2Me( | 34 static scoped_ptr<Authenticator> CreateForIt2Me( |
33 const std::string& local_id, | 35 const std::string& local_id, |
34 const std::string& remote_id, | 36 const std::string& remote_id, |
(...skipping 11 matching lines...) Expand all Loading... |
46 scoped_refptr<RsaKeyPair> key_pair, | 48 scoped_refptr<RsaKeyPair> key_pair, |
47 const std::string& pin_hash, | 49 const std::string& pin_hash, |
48 scoped_refptr<PairingRegistry> pairing_registry); | 50 scoped_refptr<PairingRegistry> pairing_registry); |
49 | 51 |
50 // Creates a host authenticator, using third party authentication. | 52 // Creates a host authenticator, using third party authentication. |
51 static scoped_ptr<Authenticator> CreateWithThirdPartyAuth( | 53 static scoped_ptr<Authenticator> CreateWithThirdPartyAuth( |
52 const std::string& local_id, | 54 const std::string& local_id, |
53 const std::string& remote_id, | 55 const std::string& remote_id, |
54 const std::string& local_cert, | 56 const std::string& local_cert, |
55 scoped_refptr<RsaKeyPair> key_pair, | 57 scoped_refptr<RsaKeyPair> key_pair, |
56 scoped_ptr<TokenValidator> token_validator); | 58 scoped_refptr<TokenValidatorFactory> token_validator_factory); |
57 | 59 |
58 // Overriden from Authenticator. | 60 // Overriden from Authenticator. |
59 void ProcessMessage(const buzz::XmlElement* message, | 61 void ProcessMessage(const buzz::XmlElement* message, |
60 const base::Closure& resume_callback) override; | 62 const base::Closure& resume_callback) override; |
61 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 63 scoped_ptr<buzz::XmlElement> GetNextMessage() override; |
62 | 64 |
63 private: | 65 private: |
64 NegotiatingHostAuthenticator(const std::string& local_id, | 66 NegotiatingHostAuthenticator(const std::string& local_id, |
65 const std::string& remote_id, | 67 const std::string& remote_id, |
66 const std::string& local_cert, | 68 const std::string& local_cert, |
67 scoped_refptr<RsaKeyPair> key_pair); | 69 scoped_refptr<RsaKeyPair> key_pair); |
68 | 70 |
69 // (Asynchronously) creates an authenticator, and stores it in | 71 // (Asynchronously) creates an authenticator, and stores it in |
70 // |current_authenticator_|. Authenticators that can be started in either | 72 // |current_authenticator_|. Authenticators that can be started in either |
71 // state will be created in |preferred_initial_state|. | 73 // state will be created in |preferred_initial_state|. |
72 // |resume_callback| is called after |current_authenticator_| is set. | 74 // |resume_callback| is called after |current_authenticator_| is set. |
73 void CreateAuthenticator(Authenticator::State preferred_initial_state, | 75 void CreateAuthenticator(Authenticator::State preferred_initial_state, |
74 const base::Closure& resume_callback); | 76 const base::Closure& resume_callback); |
75 | 77 |
76 std::string local_id_; | 78 std::string local_id_; |
77 std::string remote_id_; | 79 std::string remote_id_; |
78 | 80 |
79 std::string local_cert_; | 81 std::string local_cert_; |
80 scoped_refptr<RsaKeyPair> local_key_pair_; | 82 scoped_refptr<RsaKeyPair> local_key_pair_; |
81 | 83 |
82 // Used only for shared secret host authenticators. | 84 // Used only for shared secret host authenticators. |
83 std::string shared_secret_hash_; | 85 std::string shared_secret_hash_; |
84 | 86 |
85 // Used only for third party host authenticators. | 87 // Used only for third party host authenticators. |
86 scoped_ptr<TokenValidator> token_validator_; | 88 scoped_refptr<TokenValidatorFactory> token_validator_factory_; |
87 | 89 |
88 // Used only for pairing authenticators. | 90 // Used only for pairing authenticators. |
89 scoped_refptr<PairingRegistry> pairing_registry_; | 91 scoped_refptr<PairingRegistry> pairing_registry_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); | 93 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); |
92 }; | 94 }; |
93 | 95 |
94 } // namespace protocol | 96 } // namespace protocol |
95 } // namespace remoting | 97 } // namespace remoting |
96 | 98 |
97 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 99 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
OLD | NEW |