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

Side by Side Diff: remoting/host/access_verifier.cc

Issue 3303001: Basic user access check for chromoting host. (Closed)
Patch Set: - Created 10 years, 3 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
« no previous file with comments | « remoting/host/access_verifier.h ('k') | remoting/host/access_verifier_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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/access_verifier.h"
6
7 #include "base/logging.h"
8 #include "base/string_util.h"
9 #include "remoting/host/host_config.h"
10
11 namespace remoting {
12
13 AccessVerifier::AccessVerifier()
14 : initialized_(false) {
15 }
16
17 bool AccessVerifier::Init(HostConfig* config) {
18 std::string host_jid;
19
20 if (!config->GetString(kXmppLoginConfigPath, &host_jid) ||
21 host_jid.empty()) {
22 LOG(ERROR) << "XMPP credentials are not defined in the config.";
23 return false;
24 }
25
26 host_jid_prefix_ = host_jid + '/';
27 initialized_ = true;
28
29 return true;
30 }
31
32 bool AccessVerifier::VerifyPermissions(const std::string& client_jid) {
33 CHECK(initialized_);
34 // Check that the client has the same bare jid as the host, i.e.
35 // client's full jid starts with host's bare jid.
36 return StartsWithASCII(client_jid, host_jid_prefix_, true);
37 }
38
39 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/access_verifier.h ('k') | remoting/host/access_verifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698