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
OAuth2ClientPropertiesRegistrationAdapter improve issuerUri value check #28139
Comments
Thanks for the suggestion, @bitxon. Can you provide a bit of background on this please? I'd like to understand how you came to have the property configured but with an empty value. If we treat an empty string as we currently treat |
If in
So we will not be able to unset issuerUri in
|
Thanks for the background. Have you considered switching things around so that your configuration that's in We'd like to make it easier to unset a configuration property. #24133 is covering (some of) that. This feels like another case where it would be useful. I am reluctant to implement a point-fix that changes the handling of an empty string in this specific case for the reasons explained above. I'll flag this one so that we can see what the rest of the team thinks. |
Unless switching things around where the configuration which contains |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
This approach is working fine: spring.security.oauth2.client:
provider:
keycloak:
#issuerUri is not specified here
authorization-uri: ${oauthUrl}/protocol/openid-connect/auth
token-uri: ${oauthUrl}/protocol/openid-connect/token
jwk-set-uri: ${oauthUrl}/protocol/openid-connect/certs
user-info-uri: ${oauthUrl}/protocol/openid-connect/userinfo
user-name-attribute: preferred_username
oauthUrl: my-test-url
spring.security.oauth2.client:
provider:
keycloak:
issuerUri: ${oauthUrl}
oauthUrl: my-dev-url
spring.security.oauth2.client:
provider:
keycloak:
issuerUri: ${oauthUrl} I just wanted to emphasize that for now we have switch-on(set uri) mechanism and miss switch-off mechanism(unset uri). |
I am facing the same issues atm as I am trying to come up with a proper config-setup for different environments. It's great that we can combine different configurations but it would be great if it was possible to For example, locally I am working with a PostgreSQL database, but the deployment uses a Cloud SQL. For this I'd need to different files It would be nice if we could write a I don't know how this could be done though. Maybe if the syntax for environment variables would be extended: ${VARIABLE:} # Will be empty-string if not set
${VARIABLE:default-value} # Will never be null
${VARIABLE:default-value:true} # Will be null if set to empty-string
${VARIABLE::true} # Will be null if not set
${VARIABLE::false} # Will be empty-string if not set Then we could do something like this: spring:
cloud:
gcp:
sql:
database-name: ${DB_NAME::true}
instance-connection-name: ${DB_CONNECTION_NAME::true}
datasource:
driver-class-name: org.postgresql.Driver
password: ${JDBC_DATABASE_PASSWORD:postgres}
username: ${JDBC_DATABASE_USERNAME:root} A more pragmative solution would probably be to set any empty-string to |
@falk-stefan Support for setting a property back to |
Expected Behavior
OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible
should validate thatissuer
isnot blank
Because few lines after, code throws exception if this
issuer
isnull
oremptyString
orblankString
Current Behavior
OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible
validates thatissuer
isnot null
Context
The text was updated successfully, but these errors were encountered: