Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit d650762

Browse files
committed
Handle boolean value to fix signature issue
If an AX attribute is set to boolean(true) value it results in undefined method `gsub' for true:TrueClass error. If it's set to false then its replaced by empty string resulting in to signature mismatch on the consumer, because the server still computes false AX value. Fix is to set val to empty string if it's nil and if it's boolean type then convert it to string.
1 parent 377e6a8 commit d650762

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/openid/util.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ def Util.from_base64(s)
4747
def Util.urlencode(args)
4848
a = []
4949
args.each do |key, val|
50-
val = '' unless val
50+
if val.nil?
51+
val = ''
52+
elsif !!val == val
53+
#it's boolean let's convert it to string representation
54+
# or else CGI::escape won't like it
55+
val = val.to_s
56+
end
57+
5158
a << (CGI::escape(key) + "=" + CGI::escape(val))
5259
end
5360
a.join("&")

0 commit comments

Comments
 (0)