blob: 85c314c76295f5a4626faa4ac64be9a143e91570 [file] [log] [blame]
[email protected]76451fe72010-09-02 02:05:061// 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#ifndef REMOTING_HOST_ACCESS_VERIFIER_H_
6#define REMOTING_HOST_ACCESS_VERIFIER_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11
12namespace remoting {
13
[email protected]603e52d2010-11-24 21:27:5014namespace protocol {
15class ClientAuthToken;
16} // namespace protocol
17
[email protected]76451fe72010-09-02 02:05:0618class HostConfig;
19
20// AccessVerifier is used by to verify that the client has access to the host.
[email protected]603e52d2010-11-24 21:27:5021// Currently it
[email protected]76451fe72010-09-02 02:05:0622//
[email protected]603e52d2010-11-24 21:27:5023// 1) Checks that host and client have the same bare JID.
24// 2) Verifies that the access token can be decoded.
25//
26// TODO(sergeyu): Remove the bare-JID check, and instead ask the directory to
27// perform user authorization.
[email protected]76451fe72010-09-02 02:05:0628class AccessVerifier {
29 public:
30 AccessVerifier();
31 bool Init(HostConfig* config);
[email protected]603e52d2010-11-24 21:27:5032 bool VerifyPermissions(const std::string& client_jid,
33 const std::string& encoded_client_token);
[email protected]76451fe72010-09-02 02:05:0634
35 private:
[email protected]603e52d2010-11-24 21:27:5036 bool DecodeClientAuthToken(const std::string& encoded_client_token,
37 protocol::ClientAuthToken* client_token);
38
[email protected]76451fe72010-09-02 02:05:0639 std::string host_jid_prefix_;
40 bool initialized_;
41
42 DISALLOW_COPY_AND_ASSIGN(AccessVerifier);
43};
44
45} // namespace remoting
46
47#endif // REMOTING_HOST_ACCESS_VERIFIER_H_