Sha256: a2d89fd0b6fa61706f38527bce042fffa0f5010099142b6a2fdb19b3d9d0ebca

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

module Doorkeeper
  module OAuth
    module Helpers
      module URIChecker
        def self.valid?(url)
          uri = as_uri(url)
          uri.fragment.nil? && !uri.host.nil? && !uri.scheme.nil?
        rescue URI::InvalidURIError
          false
        end

        def self.matches?(url, client_url)
          url, client_url = as_uri(url), as_uri(client_url)
          url.query = nil
          url == client_url
        end

        def self.valid_for_authorization?(url, client_url)
          valid?(url) && client_url.split.any?{|other_url| matches?(url, other_url) }
        end

        def self.as_uri(url)
          URI.parse(url)
        end

        def self.test_uri?(url)
          url == Doorkeeper.configuration.test_redirect_uri
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-1.0.0 lib/doorkeeper/oauth/helpers/uri_checker.rb
doorkeeper-1.0.0.rc2 lib/doorkeeper/oauth/helpers/uri_checker.rb