Ensure that the native redirect_uri parameter matches with redirect_uri of the client. #1060
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.
Summary
Even though #1045 fixes the issue with broken native redirect URLs, it bypasses
Doorkeeper::OAuth::Helpers::URIChecker::valid_for_authorization?
check forauthorization_code grants. This enables
Doorkeeper:: OAuth::AuthorizationCodeRequest#validate_redirect_uri
to returntrue
if theredirect_uri
parameter is a native URI.This fix tries to fix this anomaly by changing the behaviour of
Doorkeeper::OAuth::Helpers::URIChecker::valid?
to returntrue
whenever theredirect_uri
parameter is a native URI. I think this makes more sense becausethis is a logic that is common to all grant types.
Other Information
When
Doorkeeper::OAuth::Helpers::URIChecker::valid?
returnstrue
for nativeURLs,
Doorkeeper::OAuth::Helpers::URIChecker::valid_for_authorization?
makessure that the given two urls match before returning
true
to the respectivevalidate_redirect_uri
methods of different grant types.Also gets rid of a #TODO from
Doorkeeper::OAuth::PreAuthorization
.