OLD | NEW |
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:async'; | 7 import 'dart:async'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 // TODO(nweiz): This should be a "package:" import. See issue 6745. | 10 // TODO(nweiz): This should be a "package:" import. See issue 6745. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 this._redirectEndpoint = redirect; | 132 this._redirectEndpoint = redirect; |
133 this._scopes = scopes; | 133 this._scopes = scopes; |
134 this._stateString = state; | 134 this._stateString = state; |
135 var parameters = { | 135 var parameters = { |
136 "response_type": "code", | 136 "response_type": "code", |
137 "client_id": this.identifier, | 137 "client_id": this.identifier, |
138 "redirect_uri": redirect.toString() | 138 "redirect_uri": redirect.toString() |
139 }; | 139 }; |
140 | 140 |
141 if (state != null) parameters['state'] = state; | 141 if (state != null) parameters['state'] = state; |
142 if (!scopes.isEmpty) parameters['scope'] = Strings.join(scopes, ' '); | 142 if (!scopes.isEmpty) parameters['scope'] = scopes.join(' '); |
143 | 143 |
144 return addQueryParameters(this.authorizationEndpoint, parameters); | 144 return addQueryParameters(this.authorizationEndpoint, parameters); |
145 } | 145 } |
146 | 146 |
147 /// Processes the query parameters added to a redirect from the authorization | 147 /// Processes the query parameters added to a redirect from the authorization |
148 /// server. Note that this "response" is not an HTTP response, but rather the | 148 /// server. Note that this "response" is not an HTTP response, but rather the |
149 /// data passed to a server controlled by the client as query parameters on | 149 /// data passed to a server controlled by the client as query parameters on |
150 /// the redirect URL. | 150 /// the redirect URL. |
151 /// | 151 /// |
152 /// It is a [StateError] to call this more than once, to call it before | 152 /// It is a [StateError] to call this more than once, to call it before |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 /// Closes the grant and frees its resources. | 250 /// Closes the grant and frees its resources. |
251 /// | 251 /// |
252 /// This will close the underlying HTTP client, which is shared by the | 252 /// This will close the underlying HTTP client, which is shared by the |
253 /// [Client] created by this grant, so it's not safe to close the grant and | 253 /// [Client] created by this grant, so it's not safe to close the grant and |
254 /// continue using the client. | 254 /// continue using the client. |
255 void close() { | 255 void close() { |
256 if (_httpClient != null) _httpClient.close(); | 256 if (_httpClient != null) _httpClient.close(); |
257 _httpClient = null; | 257 _httpClient = null; |
258 } | 258 } |
259 } | 259 } |
OLD | NEW |