Skip to content

Regression with Trust Email when the userinfo endpoint is used #53471

Closed

Description

@timhallmann

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

identity-brokering

Describe the bug

Previously, and according to the documentation, "Trust Email" with OIDC Identity Providers marked a given email address as verified if the IdP does not set email_verified.

Since version 26.8.0 (probably due to #50699) this missing claim is treated like email_verified: false if these claims are read from the userinfo endpoint. If the claims are read from the ID Token, the old (and documented) behavior apparently still applies.

Version

26.8.0

Regression

  • The issue is a regression

Expected behavior

The email address is marked as verified if "Trust Email" is set and the email_verified claim is not set.

Actual behavior

The email address is marked as unverified on every login if "Trust Email" is set, the claims are read from the userinfo endpoint and the email_verified claim is not set.

How to Reproduce?

Set "Trust Email" on an OIDC IdP, enable the userinfo endpoint, and configure the IdP to set an email address, but not to set email_verified.

Anything else?

I believe this regression was introduced by #50699. If so, the change in extractIdentity() should probably follow the same approach as getEmailVerifiedClaim(), so maybe something like the following diff. I have not tested this suggestion.

diff --git a/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java b/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
index 1f3587344d..7d6442694e 100755
--- a/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
+++ b/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
@@ -597,7 +597,11 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider<OIDCIde
                         familyName = getJsonProperty(userInfo, IDToken.FAMILY_NAME);
                         preferredUsername = getUsernameFromUserInfo(userInfo);
                         String userInfoEmail = getJsonProperty(userInfo, "email");
-                        Boolean userInfoEmailVerified = Boolean.parseBoolean(getJsonProperty(userInfo, IDToken.EMAIL_VERIFIED));
+                        String userInfoEmailVerifiedProperty = getJsonProperty(userInfo, IDToken.EMAIL_VERIFIED);
+                        Boolean userInfoEmailVerified = null;
+                        if(userInfoEmailVerifiedProperty != null) {
+                            userInfoEmailVerified = Boolean.parseBoolean(userInfoEmailVerifiedProperty);
+                        }
 
                         if (userInfoEmail != null) {
                             email = userInfoEmail;

Activity

  1. added
    kind/bug
    on Oct 2, 2026
  2. added theissue type on Oct 2, 2026
  3. added
    area/identity-brokering
    on Oct 2, 2026
  4. pedroigor commented on Oct 2, 2026

    @pedroigor
    Contributor

    @graziang, can you please check if it is an expected behavior after #50699 or if instead we should keep the fallback/default behavior of Trust email by only forcing the setting email verification from the user info endpoint if the claim is present?

  5. self-assigned this
    on Oct 2, 2026
  6. graziang commented on Oct 5, 2026

    @graziang
    Contributor

    @pedroigor It's not expected, it's a side effect of #50699.

    In extractIdentity() we use Boolean.parseBoolean(getJsonProperty(userInfo, IDToken.EMAIL_VERIFIED)) which returns false when the claim is missing.

    So setEmailVerified() sees a non-null value and skips the Trust email fallback. The ID Token path uses getEmailVerifiedClaim() which returns null when the claim is absent.

    We should keep the fallback and only set the status from userinfo when the claim is really there.

    Are you going to fix it? Or let me know, and I can fix it.

  7. pedroigor commented on Oct 5, 2026

    @pedroigor
    Contributor

    Thanks for the input, @graziang. We are handling it.

  8. 17 remaining items

  9. added a commit that references this issue on Oct 22, 2026
    9ce66c6
  10. added 2 commits that reference this issue on Nov 12, 2026
    136c0dd
    c115a8a
  11. added a commit that references this issue on Nov 16, 2026
    34b5c3e
  12. added a commit that references this issue on Nov 16, 2026
    7a3157c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/identity-brokeringkind/bugpriority/blockerrelease/26.4.19release/26.6.10release/26.8.1release/27.0.0team/cloud-nativeteam/continuous-deliveryteam/core-authnteam/core-iamteam/core-protocolsteam/core-sharedteam/production-readiness

Type

Fields

No fields configured for bug.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions