diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 05:38:56 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 05:38:56 +0000 |
commit | c80a199461f48fbea2fa6857e4ad23aec3a3966d (patch) | |
tree | 6136cb4d1d60bb70ec3b4742002b029710eaade5 /remoting/protocol/channel_authenticator.h | |
parent | b6cb770231a0ab13c1a5d8b227c874d3a473eb5f (diff) | |
download | chromium_src-c80a199461f48fbea2fa6857e4ad23aec3a3966d.zip chromium_src-c80a199461f48fbea2fa6857e4ad23aec3a3966d.tar.gz chromium_src-c80a199461f48fbea2fa6857e4ad23aec3a3966d.tar.bz2 |
Refactor ChannelAuthenticator so that it can be used with Authenticator.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8527018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/channel_authenticator.h')
-rw-r--r-- | remoting/protocol/channel_authenticator.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/remoting/protocol/channel_authenticator.h b/remoting/protocol/channel_authenticator.h index 4d2dc05..a95fd3d 100644 --- a/remoting/protocol/channel_authenticator.h +++ b/remoting/protocol/channel_authenticator.h @@ -15,8 +15,7 @@ namespace net { class DrainableIOBuffer; class GrowableIOBuffer; -class SSLClientSocket; -class SSLServerSocket; +class SSLSocket; } // namespace net namespace remoting { @@ -38,7 +37,7 @@ class ChannelAuthenticator : public base::NonThreadSafe { // when authentication is finished. Caller retains ownership of // |socket|. |shared_secret| is a shared secret that we use to // authenticate the channel. - virtual void Authenticate(const std::string& shared_secret, + virtual void Authenticate(net::SSLSocket* socket, const DoneCallback& done_callback) = 0; private: @@ -47,11 +46,11 @@ class ChannelAuthenticator : public base::NonThreadSafe { class HostChannelAuthenticator : public ChannelAuthenticator { public: - HostChannelAuthenticator(net::SSLServerSocket* socket); + HostChannelAuthenticator(const std::string& shared_secret); virtual ~HostChannelAuthenticator(); // ChannelAuthenticator overrides. - virtual void Authenticate(const std::string& shared_secret, + virtual void Authenticate(net::SSLSocket* socket, const DoneCallback& done_callback) OVERRIDE; private: @@ -60,8 +59,9 @@ class HostChannelAuthenticator : public ChannelAuthenticator { bool HandleAuthBytesRead(int result); bool VerifyAuthBytes(const std::string& received_auth_bytes); + std::string shared_secret_; std::string auth_bytes_; - net::SSLServerSocket* socket_; + net::SSLSocket* socket_; DoneCallback done_callback_; scoped_refptr<net::GrowableIOBuffer> auth_read_buf_; @@ -73,11 +73,11 @@ class HostChannelAuthenticator : public ChannelAuthenticator { class ClientChannelAuthenticator : public ChannelAuthenticator { public: - ClientChannelAuthenticator(net::SSLClientSocket* socket); + ClientChannelAuthenticator(const std::string& shared_secret); virtual ~ClientChannelAuthenticator(); // ChannelAuthenticator overrides. - virtual void Authenticate(const std::string& shared_secret, + virtual void Authenticate(net::SSLSocket* socket, const DoneCallback& done_callback); private: @@ -85,12 +85,14 @@ class ClientChannelAuthenticator : public ChannelAuthenticator { void OnAuthBytesWritten(int result); bool HandleAuthBytesWritten(int result); - net::SSLClientSocket* socket_; + std::string shared_secret_; + net::SSLSocket* socket_; DoneCallback done_callback_; scoped_refptr<net::DrainableIOBuffer> auth_write_buf_; - net::OldCompletionCallbackImpl<ClientChannelAuthenticator> auth_write_callback_; + net::OldCompletionCallbackImpl<ClientChannelAuthenticator> + auth_write_callback_; DISALLOW_COPY_AND_ASSIGN(ClientChannelAuthenticator); }; |