Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: remoting/protocol/channel_authenticator.cc

Issue 8527018: Refactor ChannelAuthenticator so that it can be used with Authenticator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/channel_authenticator.h ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/channel_authenticator.cc
diff --git a/remoting/protocol/channel_authenticator.cc b/remoting/protocol/channel_authenticator.cc
index 2e427a95aab39c514909743c850f8d29b997b207..fcce9b135dd483f39937a21eee3f6638d25df4a9 100644
--- a/remoting/protocol/channel_authenticator.cc
+++ b/remoting/protocol/channel_authenticator.cc
@@ -9,8 +9,7 @@
#include "crypto/hmac.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
-#include "net/socket/ssl_client_socket.h"
-#include "net/socket/ssl_server_socket.h"
+#include "net/socket/ssl_socket.h"
#include "net/socket/stream_socket.h"
namespace remoting {
@@ -46,8 +45,10 @@ bool GetAuthBytes(const std::string& shared_secret,
} // namespace
-HostChannelAuthenticator::HostChannelAuthenticator(net::SSLServerSocket* socket)
- : socket_(socket),
+HostChannelAuthenticator::HostChannelAuthenticator(
+ const std::string& shared_secret)
+ : shared_secret_(shared_secret),
+ socket_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(auth_read_callback_(
this, &HostChannelAuthenticator::OnAuthBytesRead)) {
}
@@ -55,10 +56,11 @@ HostChannelAuthenticator::HostChannelAuthenticator(net::SSLServerSocket* socket)
HostChannelAuthenticator::~HostChannelAuthenticator() {
}
-void HostChannelAuthenticator::Authenticate(const std::string& shared_secret,
+void HostChannelAuthenticator::Authenticate(net::SSLSocket* socket,
const DoneCallback& done_callback) {
DCHECK(CalledOnValidThread());
+ socket_ = socket;
done_callback_ = done_callback;
unsigned char key_material[kAuthDigestLength];
@@ -70,7 +72,7 @@ void HostChannelAuthenticator::Authenticate(const std::string& shared_secret,
return;
}
- if (!GetAuthBytes(shared_secret,
+ if (!GetAuthBytes(shared_secret_,
std::string(key_material, key_material + kAuthDigestLength),
&auth_bytes_)) {
done_callback.Run(FAILURE);
@@ -139,8 +141,9 @@ bool HostChannelAuthenticator::VerifyAuthBytes(
}
ClientChannelAuthenticator::ClientChannelAuthenticator(
- net::SSLClientSocket* socket)
- : socket_(socket),
+ const std::string& shared_secret)
+ : shared_secret_(shared_secret),
+socket_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(auth_write_callback_(
this, &ClientChannelAuthenticator::OnAuthBytesWritten)) {
}
@@ -149,10 +152,11 @@ ClientChannelAuthenticator::~ClientChannelAuthenticator() {
}
void ClientChannelAuthenticator::Authenticate(
- const std::string& shared_secret,
+ net::SSLSocket* socket,
const DoneCallback& done_callback) {
DCHECK(CalledOnValidThread());
+ socket_ = socket;
done_callback_ = done_callback;
unsigned char key_material[kAuthDigestLength];
@@ -165,7 +169,7 @@ void ClientChannelAuthenticator::Authenticate(
}
std::string auth_bytes;
- if (!GetAuthBytes(shared_secret,
+ if (!GetAuthBytes(shared_secret_,
std::string(key_material, key_material + kAuthDigestLength),
&auth_bytes)) {
done_callback.Run(FAILURE);
« no previous file with comments | « remoting/protocol/channel_authenticator.h ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698