Chromium Code Reviews| 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/basictypes.h" | 11 #include "base/basictypes.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 "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "remoting/protocol/authentication_method.h" | 15 #include "remoting/protocol/authentication_method.h" |
| 16 #include "remoting/protocol/authenticator.h" | 16 #include "remoting/protocol/authenticator.h" |
| 17 #include "remoting/protocol/negotiating_authenticator_base.h" | 17 #include "remoting/protocol/negotiating_authenticator_base.h" |
| 18 #include "remoting/protocol/third_party_host_authenticator.h" | |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 | 21 |
| 21 class RsaKeyPair; | 22 class RsaKeyPair; |
| 22 | 23 |
| 23 namespace protocol { | 24 namespace protocol { |
| 24 | 25 |
| 25 // Host-side implementation of NegotiatingAuthenticatorBase. | 26 // Host-side implementation of NegotiatingAuthenticatorBase. |
| 26 // See comments in negotiating_authenticator_base.h for a general explanation. | 27 // See comments in negotiating_authenticator_base.h for a general explanation. |
| 27 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { | 28 class NegotiatingHostAuthenticator : public NegotiatingAuthenticatorBase { |
| 28 public: | 29 public: |
| 30 virtual ~NegotiatingHostAuthenticator(); | |
| 31 | |
| 29 // Creates a host authenticator, using a fixed shared secret/PIN hash. | 32 // Creates a host authenticator, using a fixed shared secret/PIN hash. |
| 30 NegotiatingHostAuthenticator( | 33 static scoped_ptr<Authenticator> CreateWithSharedSecret( |
| 31 const std::string& local_cert, | 34 const std::string& local_cert, |
| 32 scoped_refptr<RsaKeyPair> key_pair, | 35 scoped_refptr<RsaKeyPair> key_pair, |
| 33 const std::string& shared_secret_hash, | 36 const std::string& shared_secret_hash, |
| 34 AuthenticationMethod::HashFunction hash_function); | 37 AuthenticationMethod::HashFunction hash_function); |
| 35 | 38 |
| 36 virtual ~NegotiatingHostAuthenticator(); | 39 // Creates a host authenticator, using third party authentication. |
| 40 static scoped_ptr<Authenticator> CreateWithThirdPartyAuth( | |
| 41 const std::string& local_cert, | |
| 42 scoped_refptr<RsaKeyPair> key_pair, | |
| 43 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidator> token_validator); | |
| 37 | 44 |
| 38 // Overriden from Authenticator. | 45 // Overriden from Authenticator. |
| 39 virtual void ProcessMessage(const buzz::XmlElement* message, | 46 virtual void ProcessMessage(const buzz::XmlElement* message, |
| 40 const base::Closure& resume_callback) OVERRIDE; | 47 const base::Closure& resume_callback) OVERRIDE; |
| 41 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; | 48 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
| 42 | 49 |
| 43 private: | 50 private: |
| 51 NegotiatingHostAuthenticator( | |
| 52 const std::string& local_cert, | |
| 53 scoped_refptr<RsaKeyPair> key_pair); | |
| 54 | |
| 44 // (Asynchronously) creates an authenticator, and stores it in | 55 // (Asynchronously) creates an authenticator, and stores it in |
| 45 // |current_authenticator_|. Authenticators that can be started in either | 56 // |current_authenticator_|. Authenticators that can be started in either |
| 46 // state will be created in |preferred_initial_state|. | 57 // state will be created in |preferred_initial_state|. |
| 47 // |resume_callback| is called after |current_authenticator_| is set. | 58 // |resume_callback| is called after |current_authenticator_| is set. |
| 48 void CreateAuthenticator(Authenticator::State preferred_initial_state, | 59 void CreateAuthenticator(Authenticator::State preferred_initial_state, |
| 49 const base::Closure& resume_callback); | 60 const base::Closure& resume_callback); |
| 50 | 61 |
| 51 std::string local_cert_; | 62 std::string local_cert_; |
| 52 scoped_refptr<RsaKeyPair> local_key_pair_; | 63 scoped_refptr<RsaKeyPair> local_key_pair_; |
| 64 | |
| 65 // Used only for shared secret host authenticators. | |
| 53 std::string shared_secret_hash_; | 66 std::string shared_secret_hash_; |
| 54 | 67 |
| 68 // Used only for third party host authenticators. | |
| 69 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidator> token_validator_; | |
|
Wez
2013/04/05 22:46:12
nit: blank line after this
rmsousa
2013/04/06 00:37:25
Done.
| |
| 55 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); | 70 DISALLOW_COPY_AND_ASSIGN(NegotiatingHostAuthenticator); |
| 56 }; | 71 }; |
| 57 | 72 |
| 58 } // namespace protocol | 73 } // namespace protocol |
| 59 } // namespace remoting | 74 } // namespace remoting |
| 60 | 75 |
| 61 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ | 76 #endif // REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_ |
| OLD | NEW |