Skip to content

Commit 2b6397b

Browse files
authored
DEV: Case insensitive check on email_verified field (#70)
1 parent c7e89b2 commit 2b6397b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/openid_connect_authenticator.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def primary_email_verified?(auth)
2424
true
2525
else
2626
# Many providers violate the spec, and send this as a string rather than a boolean
27-
supplied_verified_boolean == true || supplied_verified_boolean == "true"
27+
supplied_verified_boolean == true ||
28+
(supplied_verified_boolean.is_a?(String) && supplied_verified_boolean.downcase == "true")
2829
end
2930
end
3031

spec/lib/openid_connect_authenticator_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
result = authenticator.after_authenticate(hash)
4646
expect(result.user).to eq(user)
4747
end
48+
49+
it "matches the user as a titlecase true string" do
50+
hash[:extra][:raw_info][:email_verified] = "True"
51+
result = authenticator.after_authenticate(hash)
52+
expect(result.user).to eq(user)
53+
end
4854
end
4955

5056
context "when email_verified is false" do

0 commit comments

Comments
 (0)