Sha256: 98e5ce89594a9f5797a754ff656cf161e1be18966c1c5556555f9f2d4b859121
Contents?: true
Size: 917 Bytes
Versions: 12
Compression:
Stored size: 917 Bytes
Contents
module Rack module OAuth2 class Server module Utils module_function # Parses the redirect URL, normalizes it and returns a URI object. # # Raises InvalidRequestError if not an absolute HTTP/S URL. def parse_redirect_uri(redirect_uri) raise InvalidRequestError, "Missing redirect URL" unless redirect_uri uri = URI.parse(redirect_uri).normalize rescue nil raise InvalidRequestError, "Redirect URL looks fishy to me" unless uri raise InvalidRequestError, "Redirect URL must be absolute URL" unless uri.absolute? && uri.host uri end # Given scope as either array or string, return array of same names, # unique and sorted. def normalize_scope(scope) (Array === scope ? scope.join(" ") : scope || "").split(/\s+/).compact.uniq.sort end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems