rack-oauth2 0.10.0.alpha → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/rack/oauth2/server/authorize.rb +5 -1
- data/lib/rack/oauth2/util.rb +2 -7
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.0
|
1
|
+
0.10.0
|
@@ -49,7 +49,11 @@ module Rack
|
|
49
49
|
def verify_redirect_uri!(pre_registered, allow_partial_match = false)
|
50
50
|
@verified_redirect_uri = if redirect_uri.present?
|
51
51
|
verified = Array(pre_registered).any? do |_pre_registered_|
|
52
|
-
|
52
|
+
if allow_partial_match
|
53
|
+
Util.uri_match?(_pre_registered_, redirect_uri)
|
54
|
+
else
|
55
|
+
_pre_registered_.to_s == redirect_uri.to_s
|
56
|
+
end
|
53
57
|
end
|
54
58
|
if verified
|
55
59
|
redirect_uri
|
data/lib/rack/oauth2/util.rb
CHANGED
@@ -40,19 +40,14 @@ module Rack
|
|
40
40
|
redirect_uri.to_s
|
41
41
|
end
|
42
42
|
|
43
|
-
def uri_match?(base, given
|
43
|
+
def uri_match?(base, given)
|
44
44
|
base = parse_uri(base)
|
45
45
|
given = parse_uri(given)
|
46
46
|
base.path = '/' if base.path.blank?
|
47
47
|
given.path = '/' if given.path.blank?
|
48
|
-
path_match = if allow_partial_match
|
49
|
-
/^#{base.path}/ =~ given.path
|
50
|
-
else
|
51
|
-
base.path == given.path
|
52
|
-
end
|
53
48
|
[:scheme, :host, :port].all? do |key|
|
54
49
|
base.send(key) == given.send(key)
|
55
|
-
end &&
|
50
|
+
end && /^#{base.path}/ =~ given.path
|
56
51
|
rescue
|
57
52
|
false
|
58
53
|
end
|