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 oauth2_client; | 5 library oauth2_client; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 } on FormatException catch (e) { | 102 } on FormatException catch (e) { |
103 return response; | 103 return response; |
104 } | 104 } |
105 | 105 |
106 if (authenticate.scheme != 'bearer') return response; | 106 if (authenticate.scheme != 'bearer') return response; |
107 | 107 |
108 var params = authenticate.parameters; | 108 var params = authenticate.parameters; |
109 if (!params.containsKey('error')) return response; | 109 if (!params.containsKey('error')) return response; |
110 | 110 |
111 throw new AuthorizationException( | 111 throw new AuthorizationException( |
112 params['error'], params['error_description'], params['error_uri']); | 112 params['error'], params['error_description'], Uri.parse(params['error_ uri'])); |
nweiz
2013/04/29 19:46:16
Long line.
| |
113 }); | 113 }); |
114 } | 114 } |
115 | 115 |
116 /// Explicitly refreshes this client's credentials. Returns this client. | 116 /// Explicitly refreshes this client's credentials. Returns this client. |
117 /// | 117 /// |
118 /// This will throw a [StateError] if the [Credentials] can't be refreshed, an | 118 /// This will throw a [StateError] if the [Credentials] can't be refreshed, an |
119 /// [AuthorizationException] if refreshing the credentials fails, or a | 119 /// [AuthorizationException] if refreshing the credentials fails, or a |
120 /// [FormatError] if the authorization server returns invalid responses. | 120 /// [FormatError] if the authorization server returns invalid responses. |
121 /// | 121 /// |
122 /// You may request different scopes than the default by passing in | 122 /// You may request different scopes than the default by passing in |
(...skipping 14 matching lines...) Expand all Loading... | |
137 return this; | 137 return this; |
138 }); | 138 }); |
139 } | 139 } |
140 | 140 |
141 /// Closes this client and its underlying HTTP client. | 141 /// Closes this client and its underlying HTTP client. |
142 void close() { | 142 void close() { |
143 if (_httpClient != null) _httpClient.close(); | 143 if (_httpClient != null) _httpClient.close(); |
144 _httpClient = null; | 144 _httpClient = null; |
145 } | 145 } |
146 } | 146 } |
OLD | NEW |