Description
I have spring boot application with spring boot configuration.
spring: security: oauth2: client: provider: keycloak: issuer-uri: http://gateway:8080/auth/realms/myrealm registration: keycloak: client-id: spring-security client-secret: 6cea952f-10d0-4d00-ac79-cc865820dc2c
I want use openid connect discovery configuration, with oidc provider keycloak. My keycloak is behind proxy and keycloak frontend url(f.e.: login url) is different than backend keycloak url(f.e: url for obtaining token).. And Issue is when application is starting I got error:
The Issuer "http://myfrontend.com/auth/realms/myrealm" provided in the configuration metadata did not match the requested issuer "http://gateway:8080/auth/realms/myrealm
This validation is here:
https://github.com/spring-projects/spring-security/blob/master/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java#L67
My Openid connect discovery endpoint return issuer with frontend url
"issuer": "http://myfrontend.com/auth/realms/myrealm". And this is compared with value issuer-uri from configuration. I don't know why is existing this validation. I created ticket also for keycloak https://issues.redhat.com/browse/KEYCLOAK-14579, But according keycloak team issuer is right with frontend channel url
To Reproduce
spring boot application with spring security with oidc discovery configuration to keycloak. Keycloak should by behind proxy and should by configured different frontend url as backend url.
Error occurs when application starts
Expected behavior
Validation for should not exist. Or this validation is right and oidc dicovery endpoint(on keycloak) should be return issuer with backchannel url