Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: remoting/base/auth_token_util.cc

Issue 7008003: Wire in OAuth2 support into non-sandboxed connections in libjingle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_token_with_service,
11 std::string* auth_token,
12 std::string* auth_service) {
13 size_t delimiter_pos = auth_token_with_service.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.
Wez 2011/05/25 03:57:46 Mark this with a bug-#?
awong 2011/05/25 16:56:56 Done.
19 auth_token->assign(auth_token_with_service);
20 auth_service->assign(kChromotingTokenDefaultServiceName);
21 } else {
22 auth_service->assign(auth_token_with_service.substr(0, delimiter_pos));
23
24 // Make sure there is *something* after the delimiter before doing substr.
25 if (delimiter_pos < auth_token_with_service.size()) {
26 auth_token->assign(auth_token_with_service.substr(delimiter_pos + 1));
27 } else {
28 auth_token->clear();
29 }
30 }
31 }
32
33 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698