-
Notifications
You must be signed in to change notification settings - Fork 814
Allow custom uri schemes #155
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
Allow custom uri schemes #155
Conversation
Updated validate_uris, added ALLOWED_REDIRECT_URI_SCHEMES settings, and HttpResponseUriRedirect class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not intimately familiar with this function, but is there a reason for using a custom regex instead of a custom validator based on urlparse.urlparse
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not my code - that's already in the master (I just fixed the scheme to match the RFC standard).
The call seems to handle the case where the network location has been internationalized (although there are no tests for that), so that may have something to do with it.
We DO need a RedirectURIValidator (which inherits from this), because the standard says that Redirect URIs cannot contain fragments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at urlparse documentation, I can't see why this (or the safe equivalent for Python 2 and 3 compatibility) couldn't be used instead of a RegexValidator. Perhaps you might add this as a separate issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, urlparse
is what I used in my implementation (https://github.com/Locu/djoauth2/blob/9df7c3661e0a4c3585d3a333a63d5ed74472083c/djoauth2/authorization.py#L185):
if urlparse(redirect_uri).fragment:
raise InvalidRequest('"redirect_uri" must not contain a fragment')
I'll take a look at this later today / tomorrow when I have the time.
It would be great to get this merged and pushed to a release on pypi! Thanks! |
👍 |
As per #154.