| 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/support_access_verifier.h" | 5 #include "remoting/host/support_access_verifier.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 SupportAccessVerifier::SupportAccessVerifier() { | 44 SupportAccessVerifier::SupportAccessVerifier() { |
| 45 host_secret_ = GenerateRandomHostSecret(); | 45 host_secret_ = GenerateRandomHostSecret(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 SupportAccessVerifier::~SupportAccessVerifier() { } | 48 SupportAccessVerifier::~SupportAccessVerifier() { } |
| 49 | 49 |
| 50 bool SupportAccessVerifier::VerifyPermissions( | 50 bool SupportAccessVerifier::VerifyPermissions( |
| 51 const std::string& client_jid, | 51 const std::string& client_jid) { |
| 52 const std::string& encoded_access_token) { | |
| 53 if (support_id_.empty()) | 52 if (support_id_.empty()) |
| 54 return false; | 53 return false; |
| 55 std::string access_code = support_id_ + host_secret_; | 54 return true; |
| 56 return protocol::VerifySupportAuthToken( | |
| 57 client_jid, access_code, encoded_access_token); | |
| 58 } | 55 } |
| 59 | 56 |
| 60 void SupportAccessVerifier::OnIT2MeHostRegistered( | 57 void SupportAccessVerifier::OnIT2MeHostRegistered( |
| 61 bool successful, const std::string& support_id) { | 58 bool successful, const std::string& support_id) { |
| 62 if (successful) { | 59 if (successful) { |
| 63 support_id_ = support_id; | 60 support_id_ = support_id; |
| 64 } else { | 61 } else { |
| 65 LOG(ERROR) << "Failed to register support host"; | 62 LOG(ERROR) << "Failed to register support host"; |
| 66 } | 63 } |
| 67 } | 64 } |
| 68 | 65 |
| 69 } // namespace remoting | 66 } // namespace remoting |
| OLD | NEW |