| 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 #include "remoting/base/auth_token_util.h" | |
| 6 #include "remoting/base/constants.h" | |
| 7 | |
| 8 namespace remoting { | |
| 9 | |
| 10 void ParseAuthTokenWithService(const std::string& auth_service_with_token, | |
| 11 std::string* auth_token, | |
| 12 std::string* auth_service) { | |
| 13 size_t delimiter_pos = auth_service_with_token.find(':'); | |
| 14 if (delimiter_pos == std::string::npos) { | |
| 15 // Legacy case: there is no delimiter. Assume the whole string is the | |
| 16 // auth_token, and that we're using the default service. | |
| 17 // | |
| 18 // TODO(ajwong): Remove this defaulting once all webclients are migrated. | |
| 19 // BUG:83897 | |
| 20 auth_token->assign(auth_service_with_token); | |
| 21 auth_service->assign(kChromotingTokenDefaultServiceName); | |
| 22 } else { | |
| 23 auth_service->assign(auth_service_with_token.substr(0, delimiter_pos)); | |
| 24 | |
| 25 // Make sure there is *something* after the delimiter before doing substr. | |
| 26 if (delimiter_pos < auth_service_with_token.size()) { | |
| 27 auth_token->assign(auth_service_with_token.substr(delimiter_pos + 1)); | |
| 28 } else { | |
| 29 auth_token->clear(); | |
| 30 } | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 } // namespace remoting | |
| OLD | NEW |