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

Side by Side Diff: pkg/oauth2/lib/src/authorization_code_grant.dart

Issue 11308111: Refactor http.Client and http.BaseClient to allow http.Client in type annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Small fix Created 8 years, 1 month 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
« no previous file with comments | « pkg/http/lib/src/io_client.dart ('k') | pkg/oauth2/lib/src/client.dart » ('j') | 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 authorization_code_grant; 5 library authorization_code_grant;
6 6
7 import 'dart:uri'; 7 import 'dart:uri';
8 8
9 // TODO(nweiz): This should be a "package:" import. See issue 6745. 9 // TODO(nweiz): This should be a "package:" import. See issue 6745.
10 import '../../../http/lib/http.dart' as http; 10 import '../../../http/lib/http.dart' as http;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 /// client. This will usually be listed in the authorization server's 68 /// client. This will usually be listed in the authorization server's
69 /// OAuth2 API documentation. 69 /// OAuth2 API documentation.
70 final Uri authorizationEndpoint; 70 final Uri authorizationEndpoint;
71 71
72 /// A URL provided by the authorization server that this library uses to 72 /// A URL provided by the authorization server that this library uses to
73 /// obtain long-lasting credentials. This will usually be listed in the 73 /// obtain long-lasting credentials. This will usually be listed in the
74 /// authorization server's OAuth2 API documentation. 74 /// authorization server's OAuth2 API documentation.
75 final Uri tokenEndpoint; 75 final Uri tokenEndpoint;
76 76
77 /// The HTTP client used to make HTTP requests. 77 /// The HTTP client used to make HTTP requests.
78 http.BaseClient _httpClient; 78 http.Client _httpClient;
79 79
80 /// The URL to which the resource owner will be redirected after they 80 /// The URL to which the resource owner will be redirected after they
81 /// authorize this client with the authorization server. 81 /// authorize this client with the authorization server.
82 Uri _redirectEndpoint; 82 Uri _redirectEndpoint;
83 83
84 /// The scopes that the client is requesting access to. 84 /// The scopes that the client is requesting access to.
85 List<String> _scopes; 85 List<String> _scopes;
86 86
87 /// An opaque string that users of this library may specify that will be 87 /// An opaque string that users of this library may specify that will be
88 /// included in the response query parameters. 88 /// included in the response query parameters.
89 String _stateString; 89 String _stateString;
90 90
91 /// The current state of the grant object. One of [_INITIAL_STATE], 91 /// The current state of the grant object. One of [_INITIAL_STATE],
92 /// [_AWAITING_RESPONSE_STATE], or [_FINISHED_STATE]. 92 /// [_AWAITING_RESPONSE_STATE], or [_FINISHED_STATE].
93 int _state = _INITIAL_STATE; 93 int _state = _INITIAL_STATE;
94 94
95 /// Creates a new grant. 95 /// Creates a new grant.
96 /// 96 ///
97 /// [httpClient] is used for all HTTP requests made by this grant, as well as 97 /// [httpClient] is used for all HTTP requests made by this grant, as well as
98 /// those of the [Client] is constructs. 98 /// those of the [Client] is constructs.
99 AuthorizationCodeGrant( 99 AuthorizationCodeGrant(
100 this.identifier, 100 this.identifier,
101 this.secret, 101 this.secret,
102 this.authorizationEndpoint, 102 this.authorizationEndpoint,
103 this.tokenEndpoint, 103 this.tokenEndpoint,
104 {http.BaseClient httpClient}) 104 {http.Client httpClient})
105 : _httpClient = httpClient == null ? new http.Client() : httpClient; 105 : _httpClient = httpClient == null ? new http.Client() : httpClient;
106 106
107 /// Returns the URL to which the resource owner should be redirected to 107 /// Returns the URL to which the resource owner should be redirected to
108 /// authorize this client. The resource owner will then be redirected to 108 /// authorize this client. The resource owner will then be redirected to
109 /// [redirect], which should point to a server controlled by the client. This 109 /// [redirect], which should point to a server controlled by the client. This
110 /// redirect will have additional query parameters that should be passed to 110 /// redirect will have additional query parameters that should be passed to
111 /// [handleAuthorizationResponse]. 111 /// [handleAuthorizationResponse].
112 /// 112 ///
113 /// The specific permissions being requested from the authorization server may 113 /// The specific permissions being requested from the authorization server may
114 /// be specified via [scopes]. The scope strings are specific to the 114 /// be specified via [scopes]. The scope strings are specific to the
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 /// Closes the grant and frees its resources. 249 /// Closes the grant and frees its resources.
250 /// 250 ///
251 /// This will close the underlying HTTP client, which is shared by the 251 /// This will close the underlying HTTP client, which is shared by the
252 /// [Client] created by this grant, so it's not safe to close the grant and 252 /// [Client] created by this grant, so it's not safe to close the grant and
253 /// continue using the client. 253 /// continue using the client.
254 void close() { 254 void close() {
255 if (_httpClient != null) _httpClient.close(); 255 if (_httpClient != null) _httpClient.close();
256 _httpClient = null; 256 _httpClient = null;
257 } 257 }
258 } 258 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/io_client.dart ('k') | pkg/oauth2/lib/src/client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698