blob: 598a632b8976c2d81a53444823a2e26508fe6333 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// 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/desktop_environment.h"
#include "remoting/host/capturer.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/user_authenticator.h"
#include "remoting/proto/auth.pb.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/input_stub.h"
using remoting::protocol::InputStub;
namespace remoting {
DesktopEnvironment::DesktopEnvironment(Capturer* capturer,
InputStub* input_stub)
: event_handler_(NULL),
capturer_(capturer),
input_stub_(input_stub) {
}
DesktopEnvironment::~DesktopEnvironment() {
}
void DesktopEnvironment::SuggestResolution(
const protocol::SuggestResolutionRequest* msg, Task* done) {
done->Run();
delete done;
}
void DesktopEnvironment::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();
} else {
LOG(WARNING) << "Login failed for user " << credentials->username();
}
done->Run();
delete done;
}
} // namespace remoting
|