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

Unified Diff: lib/src/client.dart

Issue 1320523003: Make a bunch of API changes. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/authorization_code_grant.dart ('k') | lib/src/credentials.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/client.dart
diff --git a/lib/src/client.dart b/lib/src/client.dart
index 371eed3093c659e2059b2212e6559d05d277bdc5..d604696e0a27fcd16b882c7e062ed5d312169883 100644
--- a/lib/src/client.dart
+++ b/lib/src/client.dart
@@ -69,6 +69,9 @@ class Client extends http.BaseClient {
Credentials get credentials => _credentials;
Credentials _credentials;
+ /// Whether to use HTTP Basic authentication for authorizing the client.
+ final bool _basicAuth;
+
/// The underlying HTTP client.
http.Client _httpClient;
@@ -79,12 +82,16 @@ class Client extends http.BaseClient {
///
/// [httpClient] is the underlying client that this forwards requests to after
/// adding authorization credentials to them.
- Client(
- this.identifier,
- this.secret,
- this._credentials,
- {http.Client httpClient})
- : _httpClient = httpClient == null ? new http.Client() : httpClient;
+ ///
+ /// Thrwos an [ArgumentError] if [secret] is passed without [identifier].
Bob Nystrom 2015/08/26 16:52:44 "Throws"
nweiz 2015/08/26 20:47:28 Done.
+ Client(this._credentials, {this.identifier, this.secret,
+ bool basicAuth: true, http.Client httpClient})
+ : _basicAuth = basicAuth,
+ _httpClient = httpClient == null ? new http.Client() : httpClient {
+ if (identifier == null && secret != null) {
+ throw new ArgumentError("secret may not be passed without identifier.");
+ }
+ }
/// Sends an HTTP request with OAuth2 authorization credentials attached.
///
@@ -137,8 +144,11 @@ class Client extends http.BaseClient {
}
_credentials = await credentials.refresh(
- identifier, secret,
- newScopes: newScopes, httpClient: _httpClient);
+ identifier: identifier,
+ secret: secret,
+ newScopes: newScopes,
+ basicAuth: _basicAuth,
+ httpClient: _httpClient);
return this;
}
« no previous file with comments | « lib/src/authorization_code_grant.dart ('k') | lib/src/credentials.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698