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

When using OIDC, issuer is taken from issuer-uri instead of .well-known/openid-configuration #9410

Closed
nyvelius opened this issue Feb 5, 2021 · 1 comment
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug

Comments

@nyvelius
Copy link

nyvelius commented Feb 5, 2021

Steps to reproduce

Enter a correct issuer-uri in application.properties. Spring is able to connect to the .well-known/openid-configuration endpoint. However, instead of using the issuer from the retrieved openid-configuration, the issuer from application.properties is used. This behavior seems odd. Isn't the point of retrieving the configuration to get the correct values?

spring.security.oauth2.resourceserver.jwt.issuer-uri=https://domain

E.g., in my case I had entered the domain without a slash in issuer-uri and got an invalid iss claim exception because the claim in the token did include a slash. This slash was accurately reflected in the response from the openid-configuration.


As a side note, JwtClaimValidator currently uses simple String equality. Perhaps domains with or without a trailing slash should be consirered equivalent. Although, the easy fix seems to be to keep the String equality and get the correct issuer value from the openid-configuration.

@jzheaux
Copy link
Contributor

jzheaux commented Feb 5, 2021

Thanks for the suggestion, @nyvelius.

This feature is working as designed. The OIDC Discovery spec states that the issuer field needs to be identical to the issuer used to request the configuration:

The issuer value returned MUST be identical to the Issuer URL that was directly used to retrieve the configuration information. This MUST also be identical to the iss Claim value in ID Tokens issued from this Issuer.

Also, it seems that changing the issuer-uri property in your application to the matching value is straightforward.

Given these, I'm hesitant to change the current behavior.

@jzheaux jzheaux closed this as completed Feb 5, 2021
@jzheaux jzheaux added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants