| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_V1_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_V1_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_V1_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_V1_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "remoting/protocol/authenticator.h" | 11 #include "remoting/protocol/authenticator.h" |
| 12 | 12 |
| 13 namespace crypto { | 13 namespace crypto { |
| 14 class RSAPrivateKey; | 14 class RSAPrivateKey; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 namespace remoting { | 17 namespace remoting { |
| 18 namespace protocol { | 18 namespace protocol { |
| 19 | 19 |
| 20 class V1ClientAuthenticator : public Authenticator { | 20 class V1ClientAuthenticator : public Authenticator { |
| 21 public: | 21 public: |
| 22 V1ClientAuthenticator(const std::string& local_jid, | 22 V1ClientAuthenticator(const std::string& local_jid, |
| 23 const std::string& shared_secret); | 23 const std::string& shared_secret); |
| 24 virtual ~V1ClientAuthenticator(); | 24 virtual ~V1ClientAuthenticator(); |
| 25 | 25 |
| 26 // Authenticator interface. | 26 // Authenticator interface. |
| 27 virtual State state() const OVERRIDE; | 27 virtual State state() const OVERRIDE; |
| 28 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 28 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; |
| 29 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; | 29 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
| 30 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; | 30 virtual scoped_ptr<ChannelAuthenticator> |
| 31 CreateChannelAuthenticator() const OVERRIDE; |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 std::string local_jid_; | 34 std::string local_jid_; |
| 34 std::string shared_secret_; | 35 std::string shared_secret_; |
| 35 std::string remote_cert_; | 36 std::string remote_cert_; |
| 36 State state_; | 37 State state_; |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(V1ClientAuthenticator); | 39 DISALLOW_COPY_AND_ASSIGN(V1ClientAuthenticator); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 class V1HostAuthenticator : public Authenticator { | 42 class V1HostAuthenticator : public Authenticator { |
| 42 public: | 43 public: |
| 43 // Doesn't take ownership of |local_private_key|. | 44 // Doesn't take ownership of |local_private_key|. |
| 44 V1HostAuthenticator(const std::string& local_cert, | 45 V1HostAuthenticator(const std::string& local_cert, |
| 45 const crypto::RSAPrivateKey& local_private_key, | 46 const crypto::RSAPrivateKey& local_private_key, |
| 46 const std::string& shared_secret, | 47 const std::string& shared_secret, |
| 47 const std::string& remote_jid); | 48 const std::string& remote_jid); |
| 48 virtual ~V1HostAuthenticator(); | 49 virtual ~V1HostAuthenticator(); |
| 49 | 50 |
| 50 // Authenticator interface. | 51 // Authenticator interface. |
| 51 virtual State state() const OVERRIDE; | 52 virtual State state() const OVERRIDE; |
| 52 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 53 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; |
| 53 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; | 54 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
| 54 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; | 55 virtual scoped_ptr<ChannelAuthenticator> |
| 56 CreateChannelAuthenticator() const OVERRIDE; |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 std::string local_cert_; | 59 std::string local_cert_; |
| 58 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; | 60 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; |
| 59 std::string shared_secret_; | 61 std::string shared_secret_; |
| 60 std::string remote_jid_; | 62 std::string remote_jid_; |
| 61 State state_; | 63 State state_; |
| 62 | 64 |
| 63 DISALLOW_COPY_AND_ASSIGN(V1HostAuthenticator); | 65 DISALLOW_COPY_AND_ASSIGN(V1HostAuthenticator); |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 } // namespace protocol | 68 } // namespace protocol |
| 67 } // namespace remoting | 69 } // namespace remoting |
| 68 | 70 |
| 69 #endif // REMOTING_PROTOCOL_V1_AUTHENTICATOR_H_ | 71 #endif // REMOTING_PROTOCOL_V1_AUTHENTICATOR_H_ |
| OLD | NEW |