| OLD | NEW |
| (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 #ifndef REMOTING_HOST_SELF_ACCESS_VERIFIER_H_ | |
| 6 #define REMOTING_HOST_SELF_ACCESS_VERIFIER_H_ | |
| 7 | |
| 8 #include "remoting/host/access_verifier.h" | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 | |
| 14 class HostConfig; | |
| 15 | |
| 16 namespace protocol { | |
| 17 class ClientAuthToken; | |
| 18 } // namespace protocol | |
| 19 | |
| 20 // SelfAccessVerifier is used by to verify that the client has access | |
| 21 // to the host in the Me2Me scenario. Currently it | |
| 22 // | |
| 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. | |
| 28 class SelfAccessVerifier : public AccessVerifier { | |
| 29 public: | |
| 30 SelfAccessVerifier(); | |
| 31 virtual ~SelfAccessVerifier(); | |
| 32 | |
| 33 bool Init(HostConfig* config); | |
| 34 | |
| 35 // AccessVerifier interface. | |
| 36 virtual bool VerifyPermissions( | |
| 37 const std::string& client_jid, | |
| 38 const std::string& encoded_client_token) OVERRIDE; | |
| 39 | |
| 40 private: | |
| 41 bool DecodeClientAuthToken(const std::string& encoded_client_token, | |
| 42 protocol::ClientAuthToken* client_token); | |
| 43 | |
| 44 std::string host_jid_prefix_; | |
| 45 bool initialized_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(SelfAccessVerifier); | |
| 48 }; | |
| 49 | |
| 50 } // namespace remoting | |
| 51 | |
| 52 #endif // REMOTING_HOST_SELF_ACCESS_VERIFIER_H_ | |
| OLD | NEW |