OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/protocol/authentication_method.h" |
5 #include "remoting/test/host_info.h" | 6 #include "remoting/test/host_info.h" |
6 | 7 |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 | 9 |
9 namespace remoting { | 10 namespace remoting { |
10 namespace test { | 11 namespace test { |
11 | 12 |
12 HostInfo::HostInfo() { | 13 HostInfo::HostInfo() { |
13 } | 14 } |
14 | 15 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 status == kHostStatusOnline) { | 64 status == kHostStatusOnline) { |
64 LOG(ERROR) << host_name << " is online but is missing a jabberId"; | 65 LOG(ERROR) << host_name << " is online but is missing a jabberId"; |
65 return false; | 66 return false; |
66 } | 67 } |
67 | 68 |
68 host_info.GetString("hostOfflineReason", &offline_reason); | 69 host_info.GetString("hostOfflineReason", &offline_reason); |
69 | 70 |
70 return true; | 71 return true; |
71 } | 72 } |
72 | 73 |
| 74 bool HostInfo::IsReadyForConnection() const { |
| 75 return !host_jid.empty() && status == kHostStatusOnline; |
| 76 } |
| 77 |
| 78 ConnectionSetupInfo HostInfo::GenerateConnectionSetupInfo( |
| 79 const std::string& access_token, |
| 80 const std::string& user_name, |
| 81 const std::string& pin) const { |
| 82 ConnectionSetupInfo connection_setup_info; |
| 83 connection_setup_info.access_token = access_token; |
| 84 connection_setup_info.host_id = host_id; |
| 85 connection_setup_info.host_jid = host_jid; |
| 86 connection_setup_info.host_name = host_name; |
| 87 connection_setup_info.pin = pin; |
| 88 connection_setup_info.public_key = public_key; |
| 89 connection_setup_info.user_name = user_name; |
| 90 |
| 91 connection_setup_info.auth_methods.push_back( |
| 92 protocol::AuthenticationMethod::Spake2Pair()); |
| 93 connection_setup_info.auth_methods.push_back( |
| 94 protocol::AuthenticationMethod::Spake2( |
| 95 protocol::AuthenticationMethod::HashFunction::NONE)); |
| 96 connection_setup_info.auth_methods.push_back( |
| 97 protocol::AuthenticationMethod::Spake2( |
| 98 protocol::AuthenticationMethod::HashFunction::HMAC_SHA256)); |
| 99 connection_setup_info.auth_methods.push_back( |
| 100 protocol::AuthenticationMethod::ThirdParty()); |
| 101 |
| 102 return connection_setup_info; |
| 103 } |
| 104 |
73 } // namespace test | 105 } // namespace test |
74 } // namespace remoting | 106 } // namespace remoting |
OLD | NEW |