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 <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.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; | 25 class TokenValidatorFactory; |
26 | 26 |
27 // Host-side implementation of NegotiatingAuthenticatorBase. | 27 // Host-side implementation of NegotiatingAuthenticatorBase. |
28 // See comments in negotiating_authenticator_base.h for a general explanation. | 28 // See comments in negotiating_authenticator_base.h for a general explanation. |
29 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { | 29 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { |
30 public: | 30 public: |
31 ~NegotiatingHostAuthenticator() override; | 31 ~NegotiatingHostAuthenticator() override; |
32 | 32 |
33 // Creates a host authenticator, using a PIN or access code. If | 33 // Creates a host authenticator, using a PIN or access code. If |
34 // |pairing_registry| is non-nullptr then the paired methods will be offered, | 34 // |pairing_registry| is non-nullptr then the paired methods will be offered, |
35 // supporting PIN-less authentication. | 35 // supporting PIN-less authentication. |
36 static scoped_ptr<NegotiatingHostAuthenticator> CreateWithSharedSecret( | 36 static std::unique_ptr<NegotiatingHostAuthenticator> CreateWithSharedSecret( |
37 const std::string& local_id, | 37 const std::string& local_id, |
38 const std::string& remote_id, | 38 const std::string& remote_id, |
39 const std::string& local_cert, | 39 const std::string& local_cert, |
40 scoped_refptr<RsaKeyPair> key_pair, | 40 scoped_refptr<RsaKeyPair> key_pair, |
41 const std::string& pin_hash, | 41 const std::string& pin_hash, |
42 scoped_refptr<PairingRegistry> pairing_registry); | 42 scoped_refptr<PairingRegistry> pairing_registry); |
43 | 43 |
44 // Creates a host authenticator, using third party authentication. | 44 // Creates a host authenticator, using third party authentication. |
45 static scoped_ptr<NegotiatingHostAuthenticator> CreateWithThirdPartyAuth( | 45 static std::unique_ptr<NegotiatingHostAuthenticator> CreateWithThirdPartyAuth( |
46 const std::string& local_id, | 46 const std::string& local_id, |
47 const std::string& remote_id, | 47 const std::string& remote_id, |
48 const std::string& local_cert, | 48 const std::string& local_cert, |
49 scoped_refptr<RsaKeyPair> key_pair, | 49 scoped_refptr<RsaKeyPair> key_pair, |
50 scoped_refptr<TokenValidatorFactory> token_validator_factory); | 50 scoped_refptr<TokenValidatorFactory> token_validator_factory); |
51 | 51 |
52 // Overriden from Authenticator. | 52 // Overriden from Authenticator. |
53 void ProcessMessage(const buzz::XmlElement* message, | 53 void ProcessMessage(const buzz::XmlElement* message, |
54 const base::Closure& resume_callback) override; | 54 const base::Closure& resume_callback) override; |
55 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 55 std::unique_ptr<buzz::XmlElement> GetNextMessage() override; |
56 | 56 |
57 private: | 57 private: |
58 NegotiatingHostAuthenticator(const std::string& local_id, | 58 NegotiatingHostAuthenticator(const std::string& local_id, |
59 const std::string& remote_id, | 59 const std::string& remote_id, |
60 const std::string& local_cert, | 60 const std::string& local_cert, |
61 scoped_refptr<RsaKeyPair> key_pair); | 61 scoped_refptr<RsaKeyPair> key_pair); |
62 | 62 |
63 // (Asynchronously) creates an authenticator, and stores it in | 63 // (Asynchronously) creates an authenticator, and stores it in |
64 // |current_authenticator_|. Authenticators that can be started in either | 64 // |current_authenticator_|. Authenticators that can be started in either |
65 // state will be created in |preferred_initial_state|. | 65 // state will be created in |preferred_initial_state|. |
(...skipping 17 matching lines...) Expand all Loading... |
83 | 83 |
84 std::string client_id_; | 84 std::string client_id_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); | 86 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace protocol | 89 } // namespace protocol |
90 } // namespace remoting | 90 } // namespace remoting |
91 | 91 |
92 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 92 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
OLD | NEW |