Repository navigation
Description
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;
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fieldsDone
Activity
pedroigor commentedon Oct 2, 2026
@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 emailby only forcing the setting email verification from the user info endpoint if the claim is present?graziang commentedon Oct 5, 2026
@pedroigor It's not expected, it's a side effect of #50699.
In
extractIdentity()we useBoolean.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 usesgetEmailVerifiedClaim()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.
pedroigor commentedon Oct 5, 2026
Thanks for the input, @graziang. We are handling it.
17 remaining items
Regression with Trust Email when the userinfo endpoint is used
Preserve email_verified from ID token when userinfo omits it. Closes k…
Preserve email_verified from ID token when userinfo omits it. Closes k…
Preserve email_verified from ID token when userinfo omits it. Closes #…
Preserve email_verified from ID token when userinfo omits it. Closes #…