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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/host/client_session.h"
6
7 #include "base/scoped_ptr.h"
8 #include "base/task.h"
9 #include "remoting/host/user_authenticator.h"
10 #include "remoting/proto/auth.pb.h"
11
12 namespace remoting {
13
14 ClientSession::ClientSession(
15 EventHandler* event_handler,
16 scoped_refptr<protocol::ConnectionToClient> connection)
17 : event_handler_(event_handler),
18 connection_(connection) {
19 }
20
21 ClientSession::~ClientSession() {
22 }
23
24 void ClientSession::SuggestResolution(
25 const protocol::SuggestResolutionRequest* msg, Task* done) {
26 done->Run();
27 delete done;
28 }
29
30 void ClientSession::BeginSessionRequest(
31 const protocol::LocalLoginCredentials* credentials, Task* done) {
32 DCHECK(event_handler_);
33
34 bool success = false;
35 scoped_ptr<UserAuthenticator> authenticator(UserAuthenticator::Create());
36 switch (credentials->type()) {
37 case protocol::PASSWORD:
38 success = authenticator->Authenticate(credentials->username(),
39 credentials->credential());
40 break;
41
42 default:
43 LOG(ERROR) << "Invalid credentials type " << credentials->type();
44 break;
45 }
46
47 if (success) {
48 event_handler_->LocalLoginSucceeded(connection_.get());
49 } else {
50 LOG(WARNING) << "Login failed for user " << credentials->username();
51 event_handler_->LocalLoginFailed(connection_.get());
52 }
53
54 done->Run();
55 delete done;
56 }
57
58 void ClientSession::Disconnect() {
59 connection_->Disconnect();
60 }
61
62 protocol::ConnectionToClient* ClientSession::connection() {
63 return connection_.get();
64 }
65
66 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698