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

Unified Diff: remoting/host/client_session.cc

Issue 6711033: A new authenticated connection evicts an old one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant member of HostMessageDispatcher. Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
new file mode 100755
index 0000000000000000000000000000000000000000..05ad97c0bf616d2b5e75b84248bdfd76279f948a
--- /dev/null
+++ b/remoting/host/client_session.cc
@@ -0,0 +1,66 @@
+// 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.
+
+#include "remoting/host/client_session.h"
+
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "remoting/host/user_authenticator.h"
+#include "remoting/proto/auth.pb.h"
+
+namespace remoting {
+
+ClientSession::ClientSession(
+ EventHandler* event_handler,
+ scoped_refptr<protocol::ConnectionToClient> connection)
+ : event_handler_(event_handler),
+ connection_(connection) {
+}
+
+ClientSession::~ClientSession() {
+}
+
+void ClientSession::SuggestResolution(
+ const protocol::SuggestResolutionRequest* msg, Task* done) {
+ done->Run();
+ delete done;
+}
+
+void ClientSession::BeginSessionRequest(
+ const protocol::LocalLoginCredentials* credentials, Task* done) {
+ DCHECK(event_handler_);
+
+ bool success = false;
+ scoped_ptr<UserAuthenticator> authenticator(UserAuthenticator::Create());
+ switch (credentials->type()) {
+ case protocol::PASSWORD:
+ success = authenticator->Authenticate(credentials->username(),
+ credentials->credential());
+ break;
+
+ default:
+ LOG(ERROR) << "Invalid credentials type " << credentials->type();
+ break;
+ }
+
+ if (success) {
+ event_handler_->LocalLoginSucceeded(connection_.get());
+ } else {
+ LOG(WARNING) << "Login failed for user " << credentials->username();
+ event_handler_->LocalLoginFailed(connection_.get());
+ }
+
+ done->Run();
+ delete done;
+}
+
+void ClientSession::Disconnect() {
+ connection_->Disconnect();
+}
+
+protocol::ConnectionToClient* ClientSession::connection() {
+ return connection_.get();
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698