Validating redirect_uri according to rfc6749 4.1.3#45
Open
Conversation
rmccue
requested changes
Sep 9, 2017
| private function validate_redirect_uri( $args ) { | ||
| $value = $this->get_value(); | ||
|
|
||
| if ( ! empty( $args['redirect_uri'] ) ) { |
Member
There was a problem hiding this comment.
Can we invert this check instead to return early?
| return (int) $value['expiration']; | ||
| } | ||
|
|
||
| private function validate_redirect_uri( $args ) { |
Member
There was a problem hiding this comment.
This should be protected instead, and should have a phpDoc block.
| $redirect_uri = $this->validate_redirect_uri( $client, $redirect_uri ); | ||
| if ( is_wp_error( $redirect_uri ) ) { | ||
| return $redirect_uri; | ||
| if ( ! empty( $redirect_uri ) ) { |
Member
There was a problem hiding this comment.
Seems like this should always pass the $redirect_uri in?
Collaborator
Author
|
@rmccue fixed it up a bit as suggested. Also if there was no redirect_uri in the initial auth request, but there is one in the access token request and it matches the callbacks registered with the client - it's fine, just for convenience reasons. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://tools.ietf.org/html/rfc6749#section-4.1.3
Check whether redirect_uri matches the one in the initial request;
validate_redirect_urifunction does not return a registered callback from the DB anymore, if no redirect_uri has been given, as it is an optional parameter. The name of the function did not explain the behaviour well.#17