You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support subdomain matching for Organizations in IdP redirect logic #40026
When using the Organizations feature in Keycloak 26.2.2, domain-based redirection to the correct Identity Provider (IdP) only works if the email domain matches exactly the configured domain in the organization settings.
This leads to problems in real-world scenarios where users log in with email addresses that include subdomains (e.g. user@sub.example.com) while the organization is configured for example.com. The domain lookup fails and Keycloak either shows a login error or throws a NullPointerException.
Support for subdomain matching (e.g. *.example.com) or suffix-based resolution (e.g. endsWith("onmicrosoft.com")) is currently not available.
Discussion
No response
Motivation
Subdomain matching would improve usability and make the Organizations feature suitable for:
Microsoft 365 tenants that use subdomains like tenant.onmicrosoft.com
Multi-tenant environments where customers use shared top-level domains
Cases where departments or subsidiaries have their own subdomain
Avoiding hard-to-maintain lists of every possible subdomain
This would also reduce login failures and improve user experience in diverse enterprise environments.
Details
A potential solution could include:
Supporting wildcards in organization domain configuration (*.example.com)
Adding a fallback mechanism for partial matches (e.g., endsWith())
Allowing a checkbox in the UI to disable automatic domain-to-organization resolution for generic domains like gmail.com
We’re happy to contribute ideas or testing support if this feature is considered for a future release.
Reacted by SebastEnn, Hugo Muller, emouty, Antoine Lange, William Clem, spillefb, Hugo Salesses, Glutenfree69, Mickael999, Guillaume and 1 more
Activity