Index: remoting/host/security_key/security_key_extension_session.cc |
diff --git a/remoting/host/security_key/gnubby_extension_session.cc b/remoting/host/security_key/security_key_extension_session.cc |
similarity index 74% |
rename from remoting/host/security_key/gnubby_extension_session.cc |
rename to remoting/host/security_key/security_key_extension_session.cc |
index 5ca27360ca0e58435771cb36f2c5a261cff944f8..a1e128719b3b2a25110e289fb18473686c6c8998 100644 |
--- a/remoting/host/security_key/gnubby_extension_session.cc |
+++ b/remoting/host/security_key/security_key_extension_session.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "remoting/host/security_key/gnubby_extension_session.h" |
+#include "remoting/host/security_key/security_key_extension_session.h" |
#include "base/bind.h" |
#include "base/json/json_reader.h" |
@@ -12,7 +12,7 @@ |
#include "base/values.h" |
#include "remoting/base/logging.h" |
#include "remoting/host/client_session_details.h" |
-#include "remoting/host/security_key/gnubby_auth_handler.h" |
+#include "remoting/host/security_key/security_key_auth_handler.h" |
#include "remoting/proto/control.pb.h" |
#include "remoting/protocol/client_stub.h" |
@@ -21,14 +21,14 @@ namespace { |
// Used as the type attribute of all Security Key protocol::ExtensionMessages. |
const char kExtensionMessageType[] = "gnubby-auth"; |
-// Gnubby extension message data members. |
+// SecurityKey extension message data members. |
const char kConnectionId[] = "connectionId"; |
const char kControlMessage[] = "control"; |
const char kControlOption[] = "option"; |
const char kDataMessage[] = "data"; |
const char kDataPayload[] = "data"; |
const char kErrorMessage[] = "error"; |
-const char kGnubbyAuthV1[] = "auth-v1"; |
+const char kSecurityKeyAuthV1[] = "auth-v1"; |
const char kMessageType[] = "type"; |
// Returns the command code (the first byte of the data) if it exists, or -1 if |
@@ -60,25 +60,25 @@ bool ConvertListValueToString(base::ListValue* bytes, std::string* out) { |
namespace remoting { |
-GnubbyExtensionSession::GnubbyExtensionSession( |
+SecurityKeyExtensionSession::SecurityKeyExtensionSession( |
ClientSessionDetails* client_session_details, |
protocol::ClientStub* client_stub) |
: client_stub_(client_stub) { |
DCHECK(client_stub_); |
- gnubby_auth_handler_ = remoting::GnubbyAuthHandler::Create( |
+ security_key_auth_handler_ = remoting::SecurityKeyAuthHandler::Create( |
client_session_details, |
- base::Bind(&GnubbyExtensionSession::SendMessageToClient, |
+ base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, |
base::Unretained(this))); |
} |
-GnubbyExtensionSession::~GnubbyExtensionSession() {} |
+SecurityKeyExtensionSession::~SecurityKeyExtensionSession() {} |
// Returns true if the |message| is a Security Key ExtensionMessage. |
// This is done so the host does not pass |message| to other HostExtensions. |
// TODO(joedow): Use |client_session_details| to disconnect the session if we |
// receive an invalid extension message. |
-bool GnubbyExtensionSession::OnExtensionMessage( |
+bool SecurityKeyExtensionSession::OnExtensionMessage( |
ClientSessionDetails* client_session_details, |
protocol::ClientStub* client_stub, |
const protocol::ExtensionMessage& message) { |
@@ -114,7 +114,7 @@ bool GnubbyExtensionSession::OnExtensionMessage( |
return true; |
} |
-void GnubbyExtensionSession::ProcessControlMessage( |
+void SecurityKeyExtensionSession::ProcessControlMessage( |
base::DictionaryValue* message_data) const { |
std::string option; |
if (!message_data->GetString(kControlOption, &option)) { |
@@ -122,14 +122,14 @@ void GnubbyExtensionSession::ProcessControlMessage( |
return; |
} |
- if (option == kGnubbyAuthV1) { |
- gnubby_auth_handler_->CreateGnubbyConnection(); |
+ if (option == kSecurityKeyAuthV1) { |
+ security_key_auth_handler_->CreateSecurityKeyConnection(); |
} else { |
VLOG(2) << "Invalid gnubby-auth control option: " << option; |
} |
} |
-void GnubbyExtensionSession::ProcessDataMessage( |
+void SecurityKeyExtensionSession::ProcessDataMessage( |
base::DictionaryValue* message_data) const { |
int connection_id; |
if (!message_data->GetInteger(kConnectionId, &connection_id)) { |
@@ -137,7 +137,7 @@ void GnubbyExtensionSession::ProcessDataMessage( |
return; |
} |
- if (!gnubby_auth_handler_->IsValidConnectionId(connection_id)) { |
+ if (!security_key_auth_handler_->IsValidConnectionId(connection_id)) { |
LOG(WARNING) << "Unknown gnubby-auth data connection: '" << connection_id |
<< "'"; |
return; |
@@ -147,16 +147,16 @@ void GnubbyExtensionSession::ProcessDataMessage( |
std::string response; |
if (message_data->GetList(kDataPayload, &bytes) && |
ConvertListValueToString(bytes, &response)) { |
- HOST_LOG << "Sending gnubby response: " << GetCommandCode(response); |
- gnubby_auth_handler_->SendClientResponse(connection_id, response); |
+ HOST_LOG << "Sending security key response: " << GetCommandCode(response); |
+ security_key_auth_handler_->SendClientResponse(connection_id, response); |
} else { |
LOG(WARNING) << "Could not extract response data from message."; |
- gnubby_auth_handler_->SendErrorAndCloseConnection(connection_id); |
+ security_key_auth_handler_->SendErrorAndCloseConnection(connection_id); |
return; |
} |
} |
-void GnubbyExtensionSession::ProcessErrorMessage( |
+void SecurityKeyExtensionSession::ProcessErrorMessage( |
base::DictionaryValue* message_data) const { |
int connection_id; |
if (!message_data->GetInteger(kConnectionId, &connection_id)) { |
@@ -164,16 +164,16 @@ void GnubbyExtensionSession::ProcessErrorMessage( |
return; |
} |
- if (gnubby_auth_handler_->IsValidConnectionId(connection_id)) { |
- HOST_LOG << "Sending gnubby error"; |
- gnubby_auth_handler_->SendErrorAndCloseConnection(connection_id); |
+ if (security_key_auth_handler_->IsValidConnectionId(connection_id)) { |
+ HOST_LOG << "Sending security key error"; |
+ security_key_auth_handler_->SendErrorAndCloseConnection(connection_id); |
} else { |
LOG(WARNING) << "Unknown gnubby-auth data connection: '" << connection_id |
<< "'"; |
} |
} |
-void GnubbyExtensionSession::SendMessageToClient( |
+void SecurityKeyExtensionSession::SendMessageToClient( |
int connection_id, |
const std::string& data) const { |
DCHECK(thread_checker_.CalledOnValidThread()); |
@@ -199,13 +199,14 @@ void GnubbyExtensionSession::SendMessageToClient( |
client_stub_->DeliverHostMessage(message); |
} |
-void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting( |
- std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) { |
- DCHECK(gnubby_auth_handler); |
+void SecurityKeyExtensionSession::SetSecurityKeyAuthHandlerForTesting( |
+ std::unique_ptr<SecurityKeyAuthHandler> security_key_auth_handler) { |
+ DCHECK(security_key_auth_handler); |
- gnubby_auth_handler_ = std::move(gnubby_auth_handler); |
- gnubby_auth_handler_->SetSendMessageCallback(base::Bind( |
- &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); |
+ security_key_auth_handler_ = std::move(security_key_auth_handler); |
+ security_key_auth_handler_->SetSendMessageCallback( |
+ base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, |
+ base::Unretained(this))); |
} |
} // namespace remoting |