Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change validation of OIDC token issuer to support parameterized queries #818

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

sp193
Copy link
Contributor

@sp193 sp193 commented Dec 5, 2024

The existing OIDC SSO support works okay, but it is incompatible with Entra ID's Multitenant mode. This is the same problem as KeyCloak's keycloak/keycloak#28662

As documented by Microsoft, the iss (issuer) field will contain the real tenant ID, while the issuer indicated in the .well-known document looks like this:

https://login.microsoftonline.com/{tenantid}/v2.0

However! The iss claim of the JWK will appear like this:

https://login.microsoftonline.com/f153796c-52b5-4ba0-bd31-9b41cb1361f1/v2.0

So if we simply entered the generic issuer value into AM for validating the JWK issuer, it'll result in a failure as the existing check just does a string comparison. However, we are required by the OIDC specification to validate the issuer.

My suggestion to increase flexibility in this area, is to allow the issuer field to contain references to values within the claims. For example, entering this:

https://login.microsoftonline.com/{tid}/v2.0

...will result in AM replacing {tid} with the tid (tenant ID) claim's value during the validation step:

https://login.microsoftonline.com/f153796c-52b5-4ba0-bd31-9b41cb1361f1/v2.0

Frankly, I do not know what Forgerock has done about this limitation, in recent AM versions. But I hope this modification would be acceptable as the OIDC specification specifies:

The Issuer Identifier [...] MUST exactly match the value of the iss (issuer) Claim.

...and Microsoft says:

The application must validate that the issuer property in the published metadata matches the iss claim in the token, in addition to the usual check that the iss claim in the token contains the tenant ID (tid) claim.

@sp193
Copy link
Contributor Author

sp193 commented Dec 5, 2024

On a side note, I also had to specify a different method for "OpenID Connect validation configuration type". The default ".well-known/openid-configuration_url" option would result in a failure as this method involves some comparison of the issuer again.

I chose jwk_uri, but I suppose client_secret should be an equally viable alternative. Combining any of these with my patch, allowed me to use Entra ID's OIDC SSO in Multitenant mode.

@sp193 sp193 force-pushed the oidc-iss-wildcards branch from 51d9f23 to b0232ca Compare December 5, 2024 15:22
…es. To support IDP like Entra ID in Multitenant mode, whereby the iss may vary.
@sp193 sp193 force-pushed the oidc-iss-wildcards branch from b0232ca to 14843ed Compare December 5, 2024 15:25
@vharseko vharseko requested a review from maximthomas December 5, 2024 15:31
Copy link
Contributor

@maximthomas maximthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @sp193!

@vharseko vharseko merged commit aee82de into OpenIdentityPlatform:master Dec 6, 2024
17 checks passed
@sp193 sp193 deleted the oidc-iss-wildcards branch December 6, 2024 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants