Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Azure to allow defining authorization_url_params #288

Merged
merged 3 commits into from
Oct 21, 2019

Conversation

gchq83514
Copy link
Contributor

I hope this is all okay. I have updated the Azure provider to allow someone to define authorization_url_params to pass additional data.

Azure supports extra parameters such as prompt, login_hint and domain_hint

https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code#request-an-authorization-code

@codecov
Copy link

codecov bot commented Oct 18, 2019

Codecov Report

Merging #288 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #288      +/-   ##
==========================================
+ Coverage   96.63%   96.66%   +0.02%     
==========================================
  Files          28       28              
  Lines         922      929       +7     
==========================================
+ Hits          891      898       +7     
  Misses         31       31
Impacted Files Coverage Δ
flask_dance/contrib/azure.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f42014...509fa6c. Read the comment docs.

@singingwolfboy
Copy link
Owner

This is great! Thank you so much for doing this!

However, it sounds like your goal is being able to set prompt, login_hint and domain_hint. Why not add those to the argument list for make_azure_blueprint(), instead of making users understand where they need to set these values in the authorization_url_params?

For example, the Google blueprint does this for the reprompt_consent, reprompt_select_account, and hosted_domain arguments: https://github.com/singingwolfboy/flask-dance/blob/master/flask_dance/contrib/google.py#L86-L94

Does that seem closer to what you want? Or is there a reason why you want to allow users to set authorization_url_params dynamically?

@singingwolfboy
Copy link
Owner

Also, thanks for fixing the documentation tests! I've cherry-picked that commit onto the master branch, so you can remove it from this pull request. 😄

@gchq83514
Copy link
Contributor Author

This is great! Thank you so much for doing this!

However, it sounds like your goal is being able to set prompt, login_hint and domain_hint. Why not add those to the argument list for make_azure_blueprint(), instead of making users understand where they need to set these values in the authorization_url_params?

For example, the Google blueprint does this for the reprompt_consent, reprompt_select_account, and hosted_domain arguments: https://github.com/singingwolfboy/flask-dance/blob/master/flask_dance/contrib/google.py#L86-L94

Does that seem closer to what you want? Or is there a reason why you want to allow users to set authorization_url_params dynamically?

No problem!

The only argument I really need is prompt but thought I would include the others for peoples information.

I will add them to the argument list as you suggest.

Would you like me to do it under a new PR or keep this one open?

Thanks

@singingwolfboy
Copy link
Owner

You can rebase this pull request and make the changes here, or close this one and open a new one. Whichever you prefer -- it makes no difference to me!

@singingwolfboy
Copy link
Owner

Here's a handy guide for how to rebase, if you're not familiar with it: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request

Updated Azure to allow defining authorization_url_params

Fix format for black

Fixed some doc issues with Python Requests preventing the tests passing

Revert "Fixed some doc issues with Python Requests preventing the tests passing"

This reverts commit b9ae3f4.
@gchq83514
Copy link
Contributor Author

Here's a handy guide for how to rebase, if you're not familiar with it: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request

Thanks for the link, I have rebased and will work on the aforementioned changes

promt, domain_hint and login_hint
@gchq83514
Copy link
Contributor Author

All tests pass.

Hopefully this is okay. I couldn't implement exactly like the Google one using bools, as Azure SSO only allows one prompt not multiple.

Thanks

Copy link
Owner

@singingwolfboy singingwolfboy left a comment

Choose a reason for hiding this comment

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

Fantastic! However, there's one other change you need to make: please move these new function arguments to the end of the list, after the "tenant" argument. If people are calling make_azure_blueprint() with positional arguments, this change in argument ordering could cause backwards incompatibilities. For example, if someone calls make_azure_blueprint("my-id", "my-secret", "scope1,scope2,scope3"), they would expect the third argument to be treated as scopes -- but right now, it would suddenly become domain_hint!

I think that once you make this change (and reorder the documentation for these arguments to match) this will be ready to merge!

@gchq83514
Copy link
Contributor Author

Hello,

Very valid point, I forgot people might not specify the param name when calling the function!

Hopefully this is now complete. Thanks

@singingwolfboy singingwolfboy merged commit 9637f5a into singingwolfboy:master Oct 21, 2019
@singingwolfboy
Copy link
Owner

Fantastic! This is now merged, and released with Flask-Dance 3.0! 😄

@gchq83514
Copy link
Contributor Author

Awesome, thank you! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants