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

Side by Side Diff: utils/pub/oauth2.dart

Issue 11565046: Don't log a user's credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a bug. Created 8 years 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
« utils/pub/io.dart ('K') | « utils/pub/io.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library oauth2; 5 library oauth2;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:uri'; 8 import 'dart:uri';
9 9
10 // TODO(nweiz): Make this a "package:" URL, or something nicer than this. 10 // TODO(nweiz): Make this a "package:" URL, or something nicer than this.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 }); 132 });
133 } 133 }
134 134
135 /// Save the user's OAuth2 credentials to the in-memory cache and the 135 /// Save the user's OAuth2 credentials to the in-memory cache and the
136 /// filesystem. 136 /// filesystem.
137 Future _saveCredentials(SystemCache cache, Credentials credentials) { 137 Future _saveCredentials(SystemCache cache, Credentials credentials) {
138 log.fine('Saving OAuth2 credentials.'); 138 log.fine('Saving OAuth2 credentials.');
139 _credentials = credentials; 139 _credentials = credentials;
140 var path = _credentialsFile(cache); 140 var path = _credentialsFile(cache);
141 return ensureDir(dirname(path)).chain((_) => 141 return ensureDir(dirname(path)).chain((_) =>
142 writeTextFile(path, credentials.toJson())); 142 writeTextFile(path, credentials.toJson(), dontLogContents: true));
143 } 143 }
144 144
145 /// The path to the file in which the user's OAuth2 credentials are stored. 145 /// The path to the file in which the user's OAuth2 credentials are stored.
146 String _credentialsFile(SystemCache cache) => 146 String _credentialsFile(SystemCache cache) =>
147 join(cache.rootDir, 'credentials.json'); 147 join(cache.rootDir, 'credentials.json');
148 148
149 /// Gets the user to authorize pub as a client of pub.dartlang.org via oauth2. 149 /// Gets the user to authorize pub as a client of pub.dartlang.org via oauth2.
150 /// Returns a Future that will complete to a fully-authorized [Client]. 150 /// Returns a Future that will complete to a fully-authorized [Client].
151 Future<Client> _authorize() { 151 Future<Client> _authorize() {
152 // Allow the tests to inject their own token endpoint URL. 152 // Allow the tests to inject their own token endpoint URL.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 'Pub needs your authorization to upload packages on your behalf.\n' 193 'Pub needs your authorization to upload packages on your behalf.\n'
194 'In a web browser, go to $authUrl\n' 194 'In a web browser, go to $authUrl\n'
195 'Then click "Allow access".\n\n' 195 'Then click "Allow access".\n\n'
196 'Waiting for your authorization...'); 196 'Waiting for your authorization...');
197 197
198 return completer.future.transform((client) { 198 return completer.future.transform((client) {
199 log.message('Successfully authorized.\n'); 199 log.message('Successfully authorized.\n');
200 return client; 200 return client;
201 }); 201 });
202 } 202 }
OLDNEW
« utils/pub/io.dart ('K') | « utils/pub/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698