Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/omniauth/microsoft_graph/domain_verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def verify!
# This means while it's not suitable for consistently identifying a user
# (the domain might change), it is suitable for verifying membership in
# a given domain.
return true if email_domain == upn_domain ||
return true if email_domain.casecmp?(upn_domain) ||
skip_verification == true ||
(skip_verification.is_a?(Array) && skip_verification.include?(email_domain)) ||
domain_verified_jwt_claim
Expand Down
7 changes: 7 additions & 0 deletions spec/omniauth/microsoft_graph/domain_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
it { is_expected.to be_truthy }
end

context 'when email domain and userPrincipalName domain match but have different casing' do
let(:email) { 'foo@example.com' }
let(:upn) { 'bar@EXAMPLE.COM' }

it { is_expected.to be_truthy }
end

context 'when domain validation is disabled' do
let(:options) { super().merge(skip_domain_verification: true) }

Expand Down