| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace protocol { | 23 namespace protocol { |
| 24 | 24 |
| 25 // Host-side implementation of NegotiatingAuthenticatorBase. | 25 // Host-side implementation of NegotiatingAuthenticatorBase. |
| 26 // See comments in negotiating_authenticator_base.h for a general explanation. | 26 // See comments in negotiating_authenticator_base.h for a general explanation. |
| 27 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { | 27 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { |
| 28 public: | 28 public: |
| 29 ~NegotiatingHostAuthenticator() override; | 29 ~NegotiatingHostAuthenticator() override; |
| 30 | 30 |
| 31 // Creates a host authenticator for It2Me host. | 31 // Creates a host authenticator for It2Me host. |
| 32 static scoped_ptr<Authenticator> CreateForIt2Me( | 32 static scoped_ptr<Authenticator> CreateForIt2Me( |
| 33 const std::string& local_id, |
| 34 const std::string& remote_id, |
| 33 const std::string& local_cert, | 35 const std::string& local_cert, |
| 34 scoped_refptr<RsaKeyPair> key_pair, | 36 scoped_refptr<RsaKeyPair> key_pair, |
| 35 const std::string& access_code); | 37 const std::string& access_code); |
| 36 | 38 |
| 37 // Creates a host authenticator, using a fixed PIN. If |pairing_registry| is | 39 // Creates a host authenticator, using a fixed PIN. If |pairing_registry| is |
| 38 // non-nullptr then the paired methods will be offered, supporting | 40 // non-nullptr then the paired methods will be offered, supporting |
| 39 // PIN-less authentication. | 41 // PIN-less authentication. |
| 40 static scoped_ptr<Authenticator> CreateWithPin( | 42 static scoped_ptr<Authenticator> CreateWithPin( |
| 43 const std::string& local_id, |
| 44 const std::string& remote_id, |
| 41 const std::string& local_cert, | 45 const std::string& local_cert, |
| 42 scoped_refptr<RsaKeyPair> key_pair, | 46 scoped_refptr<RsaKeyPair> key_pair, |
| 43 const std::string& pin_hash, | 47 const std::string& pin_hash, |
| 44 scoped_refptr<PairingRegistry> pairing_registry); | 48 scoped_refptr<PairingRegistry> pairing_registry); |
| 45 | 49 |
| 46 // Creates a host authenticator, using third party authentication. | 50 // Creates a host authenticator, using third party authentication. |
| 47 static scoped_ptr<Authenticator> CreateWithThirdPartyAuth( | 51 static scoped_ptr<Authenticator> CreateWithThirdPartyAuth( |
| 52 const std::string& local_id, |
| 53 const std::string& remote_id, |
| 48 const std::string& local_cert, | 54 const std::string& local_cert, |
| 49 scoped_refptr<RsaKeyPair> key_pair, | 55 scoped_refptr<RsaKeyPair> key_pair, |
| 50 scoped_ptr<TokenValidator> token_validator); | 56 scoped_ptr<TokenValidator> token_validator); |
| 51 | 57 |
| 52 // Overriden from Authenticator. | 58 // Overriden from Authenticator. |
| 53 void ProcessMessage(const buzz::XmlElement* message, | 59 void ProcessMessage(const buzz::XmlElement* message, |
| 54 const base::Closure& resume_callback) override; | 60 const base::Closure& resume_callback) override; |
| 55 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 61 scoped_ptr<buzz::XmlElement> GetNextMessage() override; |
| 56 | 62 |
| 57 private: | 63 private: |
| 58 NegotiatingHostAuthenticator(const std::string& local_cert, | 64 NegotiatingHostAuthenticator(const std::string& local_id, |
| 65 const std::string& remote_id, |
| 66 const std::string& local_cert, |
| 59 scoped_refptr<RsaKeyPair> key_pair); | 67 scoped_refptr<RsaKeyPair> key_pair); |
| 60 | 68 |
| 61 // (Asynchronously) creates an authenticator, and stores it in | 69 // (Asynchronously) creates an authenticator, and stores it in |
| 62 // |current_authenticator_|. Authenticators that can be started in either | 70 // |current_authenticator_|. Authenticators that can be started in either |
| 63 // state will be created in |preferred_initial_state|. | 71 // state will be created in |preferred_initial_state|. |
| 64 // |resume_callback| is called after |current_authenticator_| is set. | 72 // |resume_callback| is called after |current_authenticator_| is set. |
| 65 void CreateAuthenticator(Authenticator::State preferred_initial_state, | 73 void CreateAuthenticator(Authenticator::State preferred_initial_state, |
| 66 const base::Closure& resume_callback); | 74 const base::Closure& resume_callback); |
| 67 | 75 |
| 76 std::string local_id_; |
| 77 std::string remote_id_; |
| 78 |
| 68 std::string local_cert_; | 79 std::string local_cert_; |
| 69 scoped_refptr<RsaKeyPair> local_key_pair_; | 80 scoped_refptr<RsaKeyPair> local_key_pair_; |
| 70 | 81 |
| 71 // Used only for shared secret host authenticators. | 82 // Used only for shared secret host authenticators. |
| 72 std::string shared_secret_hash_; | 83 std::string shared_secret_hash_; |
| 73 | 84 |
| 74 // Used only for third party host authenticators. | 85 // Used only for third party host authenticators. |
| 75 scoped_ptr<TokenValidator> token_validator_; | 86 scoped_ptr<TokenValidator> token_validator_; |
| 76 | 87 |
| 77 // Used only for pairing authenticators. | 88 // Used only for pairing authenticators. |
| 78 scoped_refptr<PairingRegistry> pairing_registry_; | 89 scoped_refptr<PairingRegistry> pairing_registry_; |
| 79 | 90 |
| 80 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); | 91 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); |
| 81 }; | 92 }; |
| 82 | 93 |
| 83 } // namespace protocol | 94 } // namespace protocol |
| 84 } // namespace remoting | 95 } // namespace remoting |
| 85 | 96 |
| 86 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 97 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
| OLD | NEW |