Conversation
5 tasks
Microsoft Entra ID (Azure AD) does not follow the OIDC standard for email verification and uses alternative claim names in different scenarios: - Work/School accounts: Omit email_verified claim entirely - B2B/External ID: Use verified_primary_email or verified_secondary_email This commit extends the email verification logic to support these Microsoft- specific claims while maintaining backward compatibility with standard OIDC. Changes: - Extended _is_email_verified_claim() to check verified_primary_email and verified_secondary_email claims in addition to standard email_verified - Updated _build_normalized_user_info() to propagate Microsoft claims - Added comprehensive test coverage for all claim scenarios - Maintains precedence: email_verified > verified_primary_email > verified_secondary_email Claim precedence ensures standard OIDC claims take priority, with Microsoft claims serving as fallbacks. Absence of all claims results in pass-through (allows login) to support providers that don't include verification status. Fixes authentication failures for Entra ID users in RC2+ while maintaining security by blocking login when any claim explicitly indicates unverified email (false/0/"false"). Test coverage: 341 tests pass including 23 new tests for Microsoft claims Signed-off-by: Bogdan-Marius-Catanus <bogdan-marius.catanus@ibm.com>
Collapse the duplicated bool/int/str coercion ladder in ``_is_email_verified_claim`` and ``_build_normalized_user_info`` into a single ``_coerce_email_verified_claim`` helper driven by an ``_EMAIL_VERIFIED_CLAIMS`` precedence tuple. This removes the asymmetric fall-through for unrecognized Microsoft-claim value types (the policy is now symmetric and fail-secure across all three claims), eliminates a dead branch that duplicated the policy, and adds info / warning logs when a non-standard claim verifies an email or when an unrecognized claim type is rejected. The normalization step now stores ``email_verified`` as a coerced ``bool`` so downstream consumers cannot misread a raw ``"false"`` string as truthy. Signed-off-by: Jonathan Springer <jps@s390x.com>
dc80fe4 to
e4f3986
Compare
gcgoncalves
pushed a commit
that referenced
this pull request
Apr 23, 2026
#4396) * fix(auth): Add support for Microsoft Entra ID email verification claims Microsoft Entra ID (Azure AD) does not follow the OIDC standard for email verification and uses alternative claim names in different scenarios: - Work/School accounts: Omit email_verified claim entirely - B2B/External ID: Use verified_primary_email or verified_secondary_email This commit extends the email verification logic to support these Microsoft- specific claims while maintaining backward compatibility with standard OIDC. Changes: - Extended _is_email_verified_claim() to check verified_primary_email and verified_secondary_email claims in addition to standard email_verified - Updated _build_normalized_user_info() to propagate Microsoft claims - Added comprehensive test coverage for all claim scenarios - Maintains precedence: email_verified > verified_primary_email > verified_secondary_email Claim precedence ensures standard OIDC claims take priority, with Microsoft claims serving as fallbacks. Absence of all claims results in pass-through (allows login) to support providers that don't include verification status. Fixes authentication failures for Entra ID users in RC2+ while maintaining security by blocking login when any claim explicitly indicates unverified email (false/0/"false"). Test coverage: 341 tests pass including 23 new tests for Microsoft claims Signed-off-by: Bogdan-Marius-Catanus <bogdan-marius.catanus@ibm.com> * refactor(sso): consolidate email-verification claim coercion Collapse the duplicated bool/int/str coercion ladder in ``_is_email_verified_claim`` and ``_build_normalized_user_info`` into a single ``_coerce_email_verified_claim`` helper driven by an ``_EMAIL_VERIFIED_CLAIMS`` precedence tuple. This removes the asymmetric fall-through for unrecognized Microsoft-claim value types (the policy is now symmetric and fail-secure across all three claims), eliminates a dead branch that duplicated the policy, and adds info / warning logs when a non-standard claim verifies an email or when an unrecognized claim type is rejected. The normalization step now stores ``email_verified`` as a coerced ``bool`` so downstream consumers cannot misread a raw ``"false"`` string as truthy. Signed-off-by: Jonathan Springer <jps@s390x.com> --------- Signed-off-by: Bogdan-Marius-Catanus <bogdan-marius.catanus@ibm.com> Signed-off-by: Jonathan Springer <jps@s390x.com> Co-authored-by: Bogdan-Marius-Catanus <bogdan-marius.catanus@ibm.com> Co-authored-by: Jonathan Springer <jps@s390x.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
Closes #4391
📝 Summary
Adds support for Microsoft Entra ID (Azure AD) email verification claims to fix authentication failures for Entra ID users in RC2+.
Problem:
Microsoft Entra ID does not follow the OIDC standard for email verification:
email_verifiedclaim entirelyverified_primary_emailandverified_secondary_emailThis caused authentication to fail for organizations using Entra ID SSO, blocking upgrades from RC1 to RC2+.
Solution:
Extended email verification logic to support Microsoft-specific claims while maintaining backward compatibility:
email_verified(standard OIDC) firstverified_primary_email(Microsoft B2B/External ID)verified_secondary_email(Microsoft B2B/External ID)Impact:
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverageTest Coverage:
✅ Checklist
make black isort pre-commit)📓 Notes
Implementation Details:
Modified
_is_email_verified_claim()email_verified>verified_primary_email>verified_secondary_emailModified
_build_normalized_user_info()Test Coverage:
test_sso_user_normalization.py- Normalization scenariostest_sso_service.py- Claim verification logicClaim Precedence Examples:
Security Considerations: