Chromium Code Reviews| Index: remoting/protocol/simple_host_authenticator.h |
| diff --git a/remoting/protocol/simple_host_authenticator.h b/remoting/protocol/simple_host_authenticator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2a8493a58acdf933dad10a53aa771209b47cb2ac |
| --- /dev/null |
| +++ b/remoting/protocol/simple_host_authenticator.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_PROTOCOL_SIMPLE_HOST_AUTHENTICATOR_H_ |
| +#define REMOTING_PROTOCOL_SIMPLE_HOST_AUTHENTICATOR_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "remoting/protocol/authenticator.h" |
| + |
| +namespace crypto { |
| +class RSAPrivateKey; |
| +} // namespace base |
| + |
| +namespace remoting { |
| +namespace protocol { |
| + |
| +class SimpleHostAuthenticator : public Authenticator { |
|
Wez
2011/11/22 22:58:05
nit: It may be worth folding the client and host a
Sergey Ulanov
2011/11/23 02:02:25
Done
|
| + public: |
| + explicit SimpleHostAuthenticator(const std::string& local_cert, |
| + crypto::RSAPrivateKey* local_private_key, |
| + const std::string& shared_secret, |
| + const std::string& remote_jid); |
| + virtual ~SimpleHostAuthenticator(); |
| + |
| + // Authenticator implementation. |
| + virtual State state() const OVERRIDE; |
| + virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; |
| + virtual buzz::XmlElement* GetNextMessage() OVERRIDE; |
| + virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; |
| + |
| + private: |
| + std::string local_cert_; |
| + crypto::RSAPrivateKey* local_private_key_; |
| + std::string shared_secret_; |
| + std::string remote_jid_; |
| + State state_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SimpleHostAuthenticator); |
| +}; |
| + |
| +class SimpleHostAuthenticatorFactory : public AuthenticatorFactory { |
| + public: |
| + // Doesn't take ownership of |local_private_key|. |
| + SimpleHostAuthenticatorFactory(const std::string& local_cert, |
| + crypto::RSAPrivateKey* local_private_key, |
| + const std::string& shared_secret); |
| + virtual ~SimpleHostAuthenticatorFactory(); |
| + |
| + // AuthenticatorFactory implementation. |
| + virtual Authenticator* CreateAuthenticator( |
| + const std::string& remote_jid, |
| + const buzz::XmlElement* first_message) OVERRIDE; |
| + |
| + private: |
| + std::string local_cert_; |
| + scoped_ptr<crypto::RSAPrivateKey> local_private_key_; |
| + std::string shared_secret_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SimpleHostAuthenticatorFactory); |
| +}; |
| + |
| +} // namespace protocol |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_PROTOCOL_SIMPLE_HOST_AUTHENTICATOR_H_ |