Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Add scope delimiter option #17

Merged
merged 18 commits into from
Jun 2, 2017
Merged

Add scope delimiter option #17

merged 18 commits into from
Jun 2, 2017

Conversation

thosakwe
Copy link
Contributor

@thosakwe thosakwe commented Jan 12, 2017

this.tokenEndpoint,
{this.secret, bool basicAuth: true, http.Client httpClient})
this.identifier, this.authorizationEndpoint, this.tokenEndpoint,
{this.secret, bool basicAuth: true, http.Client httpClient})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include unrelated formatting changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I won't. Sorry, didn't know.

Uri getAuthorizationUrl(Uri redirect, {Iterable<String> scopes,
String state}) {
Uri getAuthorizationUrl(Uri redirect,
{Iterable<String> scopes, String state, String delimiter: ' '}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the delimiter parameter, and assign the default in the body rather than in the parameter list (putting it in the parameter list makes it impossible for users to express "use the default" without explicitly encoding that default).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@thosakwe
Copy link
Contributor Author

@nex3 Sorry for not updating this in a long time, but I've now made the requested changes.

@thosakwe thosakwe changed the title Fixed Facebook-related issues Add scope delimiter option Mar 11, 2017
@nex3
Copy link
Contributor

nex3 commented May 15, 2017

One more thing (sorry I didn't catch this in the first review!): I think for AuthorizationCodeGrant and Credentials, the delimiter should be set in the constructor rather than in the method. A given endpoint is always going to want the same delimiter, and for Credentials in particular you need the Client to be able to call refresh() without any extra knowledge of the quirks of the endpoint's API.

@thosakwe
Copy link
Contributor Author

Okay, that works. I'll update it tomorrow, thanks!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@googlebot googlebot added cla: no and removed cla: yes labels Jun 1, 2017
@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 1, 2017

Not really sure why the CLA thing went away, but I've signed it before.

@nex3
Copy link
Contributor

nex3 commented Jun 1, 2017

It looks like GitHub thinks that dd57b59 has an invalid author email. Did you commit with a different email than you normally use?

@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 1, 2017

No, it's the same one; however, I recently bought a new computer, so maybe that has something to do with it.

It's times like these when I realize how little I actually know about Git, haha.

@nex3
Copy link
Contributor

nex3 commented Jun 1, 2017

Looking at the commits locally, it looks like your most recent one has your email as the committer name, and Dh6743tyre08 as your email address. This doc should say how to fix that.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Jun 1, 2017
@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 1, 2017

Okay, so I was able to change my credentials locally. Had to rewrite the commit history and change my e-mail as well. CLA approval is back, woohoo!

/// The scope strings will be separated by the provided [delimiter]. This
/// defaults to `" "`, the OAuth2 standard, but some APIs (such as Facebook's)
/// use non-standard delimiters.
final String delimiter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be private, and the constructor parameter should be documented independently.

@@ -148,7 +153,7 @@ class AuthorizationCodeGrant {
};

if (state != null) parameters['state'] = state;
if (!scopes.isEmpty) parameters['scope'] = scopes.join(' ');
if (!scopes.isEmpty) parameters['scope'] = scopes.join(delimiter ?? ' ');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would simplify the data model to assign the field to ' ' if the parameter isn't passed, rather than checking on every use.

Credentials handleAccessTokenResponse(
http.Response response,
Uri tokenEndpoint,
DateTime startTime,
List<String> scopes) {
List<String> scopes,
{String delimiter}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not worth making this optional since it's only called internally.

@@ -56,13 +61,13 @@ Future<Client> resourceOwnerPasswordGrant(
}
}

if (scopes != null && !scopes.isEmpty) body['scope'] = scopes.join(' ');
if (scopes != null && !scopes.isEmpty) body['scope'] = scopes.join(delimiter ?? ' ');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to the above, just do delimiter ??= ' ' at the top of the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, just pushed commits to correct these. Let me know if they're up to your expectations!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@googlebot googlebot added cla: no and removed cla: yes labels Jun 2, 2017
@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 2, 2017

Made the changes, but I'm an idiot and keep running into the CLA thing. Give me 2 minutes to fix it. Hopefully I'll have it done by the time you see this.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Jun 2, 2017
@nex3
Copy link
Contributor

nex3 commented Jun 2, 2017

The code looks good! Can you add tests?

@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 2, 2017

Sure. Which tests?

@nex3
Copy link
Contributor

nex3 commented Jun 2, 2017

We should test every place the scope parameter escapes the package.

@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 2, 2017

All right, I'll add some, and then just let me know if I'm missing anything!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@googlebot googlebot added cla: no and removed cla: yes labels Jun 2, 2017
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Jun 2, 2017
@nex3
Copy link
Contributor

nex3 commented Jun 2, 2017

Looks good, thanks for iterating on this!

@nex3 nex3 merged commit 9b462af into dart-archive:master Jun 2, 2017
@thosakwe
Copy link
Contributor Author

thosakwe commented Jun 2, 2017

Awesome, thanks for the merge! This should fix dart-lang/tools#308. Now I'll get started on dart-lang/tools#303.

mosuem pushed a commit to dart-lang/tools that referenced this pull request Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

3 participants