[email protected] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 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 | #ifndef REMOTING_HOST_ACCESS_VERIFIER_H_ | ||||
6 | #define REMOTING_HOST_ACCESS_VERIFIER_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | |||||
10 | #include "base/basictypes.h" | ||||
11 | |||||
12 | namespace remoting { | ||||
13 | |||||
[email protected] | 603e52d | 2010-11-24 21:27:50 | [diff] [blame] | 14 | namespace protocol { |
15 | class ClientAuthToken; | ||||
16 | } // namespace protocol | ||||
17 | |||||
[email protected] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 18 | class HostConfig; |
19 | |||||
20 | // AccessVerifier is used by to verify that the client has access to the host. | ||||
[email protected] | 603e52d | 2010-11-24 21:27:50 | [diff] [blame] | 21 | // Currently it |
[email protected] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 22 | // |
[email protected] | 603e52d | 2010-11-24 21:27:50 | [diff] [blame] | 23 | // 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] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 28 | class AccessVerifier { |
29 | public: | ||||
30 | AccessVerifier(); | ||||
31 | bool Init(HostConfig* config); | ||||
[email protected] | 603e52d | 2010-11-24 21:27:50 | [diff] [blame] | 32 | bool VerifyPermissions(const std::string& client_jid, |
33 | const std::string& encoded_client_token); | ||||
[email protected] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 34 | |
35 | private: | ||||
[email protected] | 603e52d | 2010-11-24 21:27:50 | [diff] [blame] | 36 | bool DecodeClientAuthToken(const std::string& encoded_client_token, |
37 | protocol::ClientAuthToken* client_token); | ||||
38 | |||||
[email protected] | 76451fe7 | 2010-09-02 02:05:06 | [diff] [blame] | 39 | 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_ |