| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/self_access_verifier.h" | 5 #include "remoting/host/self_access_verifier.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "remoting/host/host_config.h" | 9 #include "remoting/host/host_config.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 LOG(ERROR) << "XMPP credentials are not defined in the config."; | 24 LOG(ERROR) << "XMPP credentials are not defined in the config."; |
| 25 return false; | 25 return false; |
| 26 } | 26 } |
| 27 | 27 |
| 28 host_jid_prefix_ = host_jid + '/'; | 28 host_jid_prefix_ = host_jid + '/'; |
| 29 initialized_ = true; | 29 initialized_ = true; |
| 30 | 30 |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool SelfAccessVerifier::VerifyPermissions( | 34 bool SelfAccessVerifier::VerifyPermissions(const std::string& client_jid) { |
| 35 const std::string& client_jid, | |
| 36 const std::string& encoded_access_token) { | |
| 37 CHECK(initialized_); | 35 CHECK(initialized_); |
| 38 | 36 |
| 39 // Reject incoming connection if the client's jid is not an ASCII string. | 37 // Reject incoming connection if the client's jid is not an ASCII string. |
| 40 if (!IsStringASCII(client_jid)) { | 38 if (!IsStringASCII(client_jid)) { |
| 41 LOG(ERROR) << "Rejecting incoming connection from " << client_jid; | 39 LOG(ERROR) << "Rejecting incoming connection from " << client_jid; |
| 42 return false; | 40 return false; |
| 43 } | 41 } |
| 44 | 42 |
| 45 // Check that the client has the same bare jid as the host, i.e. | 43 // Check that the client has the same bare jid as the host, i.e. |
| 46 // client's full JID starts with host's bare jid. Comparison is case | 44 // client's full JID starts with host's bare jid. Comparison is case |
| 47 // insensitive. | 45 // insensitive. |
| 48 if (!StartsWithASCII(client_jid, host_jid_prefix_, false)) { | 46 if (!StartsWithASCII(client_jid, host_jid_prefix_, false)) { |
| 49 LOG(ERROR) << "Rejecting incoming connection from " << client_jid; | 47 LOG(ERROR) << "Rejecting incoming connection from " << client_jid; |
| 50 return false; | 48 return false; |
| 51 } | 49 } |
| 52 | 50 |
| 53 // Kick off directory access permissions. | 51 // Kick off directory access permissions. |
| 54 // TODO(ajwong): Actually implement this. | 52 // TODO(ajwong): Actually implement this. |
| 55 return true; | 53 return true; |
| 56 } | 54 } |
| 57 | 55 |
| 58 } // namespace remoting | 56 } // namespace remoting |
| OLD | NEW |