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

Side by Side Diff: remoting/host/security_key/gnubby_extension_session.cc

Issue 2085353004: Update GnubbyAuthHandler to use the current session ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host_extension
Patch Set: Updating a comment Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "remoting/host/security_key/gnubby_extension_session.h" 5 #include "remoting/host/security_key/gnubby_extension_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "remoting/base/logging.h" 13 #include "remoting/base/logging.h"
14 #include "remoting/host/client_session_details.h"
14 #include "remoting/host/security_key/gnubby_auth_handler.h" 15 #include "remoting/host/security_key/gnubby_auth_handler.h"
15 #include "remoting/proto/control.pb.h" 16 #include "remoting/proto/control.pb.h"
16 #include "remoting/protocol/client_stub.h" 17 #include "remoting/protocol/client_stub.h"
17 18
18 namespace { 19 namespace {
19 20
20 // Used as the type attribute of all Security Key protocol::ExtensionMessages. 21 // Used as the type attribute of all Security Key protocol::ExtensionMessages.
21 const char kExtensionMessageType[] = "gnubby-auth"; 22 const char kExtensionMessageType[] = "gnubby-auth";
22 23
23 // Gnubby extension message data members. 24 // Gnubby extension message data members.
(...skipping 29 matching lines...) Expand all
53 } 54 }
54 } 55 }
55 return true; 56 return true;
56 } 57 }
57 58
58 } // namespace 59 } // namespace
59 60
60 namespace remoting { 61 namespace remoting {
61 62
62 GnubbyExtensionSession::GnubbyExtensionSession( 63 GnubbyExtensionSession::GnubbyExtensionSession(
64 ClientSessionDetails* client_session_details,
63 protocol::ClientStub* client_stub) 65 protocol::ClientStub* client_stub)
64 : client_stub_(client_stub) { 66 : client_stub_(client_stub) {
65 DCHECK(client_stub_); 67 DCHECK(client_stub_);
66 68
67 gnubby_auth_handler_ = remoting::GnubbyAuthHandler::Create(base::Bind( 69 gnubby_auth_handler_ = remoting::GnubbyAuthHandler::Create(
68 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); 70 client_session_details,
71 base::Bind(&GnubbyExtensionSession::SendMessageToClient,
72 base::Unretained(this)));
69 } 73 }
70 74
71 GnubbyExtensionSession::~GnubbyExtensionSession() {} 75 GnubbyExtensionSession::~GnubbyExtensionSession() {}
72 76
73 // Returns true if the |message| is a Security Key ExtensionMessage. 77 // Returns true if the |message| is a Security Key ExtensionMessage.
74 // This is done so the host does not pass |message| to other HostExtensions. 78 // This is done so the host does not pass |message| to other HostExtensions.
75 // TODO(joedow): Use |client_session_details| to disconnect the session if we 79 // TODO(joedow): Use |client_session_details| to disconnect the session if we
76 // receive an invalid extension message. 80 // receive an invalid extension message.
77 bool GnubbyExtensionSession::OnExtensionMessage( 81 bool GnubbyExtensionSession::OnExtensionMessage(
78 ClientSessionDetails* client_session_details, 82 ClientSessionDetails* client_session_details,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting( 202 void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting(
199 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) { 203 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) {
200 DCHECK(gnubby_auth_handler); 204 DCHECK(gnubby_auth_handler);
201 205
202 gnubby_auth_handler_ = std::move(gnubby_auth_handler); 206 gnubby_auth_handler_ = std::move(gnubby_auth_handler);
203 gnubby_auth_handler_->SetSendMessageCallback(base::Bind( 207 gnubby_auth_handler_->SetSendMessageCallback(base::Bind(
204 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); 208 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this)));
205 } 209 }
206 210
207 } // namespace remoting 211 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/security_key/gnubby_extension_session.h ('k') | remoting/host/security_key/gnubby_extension_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698