Skip to content

Commit

Permalink
Backport fixes from doorkeeper-gem#1060
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansch committed Aug 13, 2018
1 parent ff635c7 commit e14030c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/doorkeeper/oauth/helpers/uri_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module OAuth
module Helpers
module URIChecker
def self.valid?(url)
return true if native_uri?(url)
uri = as_uri(url)
uri.fragment.nil? && !uri.host.nil? && !uri.scheme.nil?
rescue URI::InvalidURIError
Expand Down
10 changes: 6 additions & 4 deletions lib/doorkeeper/oauth/pre_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ def validate_scopes
)
end

# TODO: test uri should be matched against the client's one
def validate_redirect_uri
return false unless redirect_uri.present?
Helpers::URIChecker.native_uri?(redirect_uri) ||
Helpers::URIChecker.valid_for_authorization?(redirect_uri, client.redirect_uri)
return false if redirect_uri.blank?

Helpers::URIChecker.valid_for_authorization?(
redirect_uri,
client.redirect_uri
)
end
end
end
Expand Down

0 comments on commit e14030c

Please sign in to comment.