No support for runtime-resolved OktaOAuth2Properties
pivovarit opened this issue · 2 comments
I'm submitting a
- bug report
Background info
I want to resolve Okta credentials when my application is initializing.
In order to achieve this, I'm wiring my instance of OktaOAuth2Properties
instead of relying on it being created from application.properties:
@Bean
@Profile("prod")
public OktaOAuth2Properties oktaConfig() {
// fetch config from somewhere
properties.setClientId(config.clientId());
properties.setClientSecret(config.clientSecret());
properties.setIssuer(config.baseUrl() + "/oauth2/default");
return properties;
}
This does not work as intended and I get complaints in logs:
[ main] ironmentPostProcessorApplicationListener : Your Okta Issuer URL is missing. You can copy your domain from the Okta Developer Console. Follow these instructions to find it: https://bit.ly/finding-okta-domain
To fix this add the `okta.oauth2.issuer` property to your application environments.
Expected behavior
All properties should be read from the OktaOAuth2Properties bean
What went wrong?
[ main] ironmentPostProcessorApplicationListener : Your Okta Issuer URL is missing. You can copy your domain from the Okta Developer Console. Follow these instructions to find it: https://bit.ly/finding-okta-domain
To fix this add the `okta.oauth2.issuer` property to your application environments.
Steps to reproduce
Create an empty project and wire your OktaOAuth2Properties instead of using application.properties
SDK Version
com.okta.spring:okta-spring-boot-starter:3.0.3
Thanks for posting!
You should ideally be using config.getIssuer()
instead of config.baseUrl()
.
I'm doing that in the production code - this is just an example. The problem is in runtime resolution and not in the content of okta.oauth2.issuer
. I managed to work it around by setting properties using a custom EnvironmentPostProcessor
, but I believe users should not be forced to do this