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

No support for runtime-resolved OktaOAuth2Properties #575

Open
1 task done
pivovarit opened this issue May 5, 2023 · 2 comments
Open
1 task done

No support for runtime-resolved OktaOAuth2Properties #575

pivovarit opened this issue May 5, 2023 · 2 comments
Assignees

Comments

@pivovarit
Copy link

pivovarit commented May 5, 2023

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

@arvindkrishnakumar-okta
Copy link
Contributor

arvindkrishnakumar-okta commented May 10, 2023

Thanks for posting!

You should ideally be using config.getIssuer() instead of config.baseUrl().

@pivovarit
Copy link
Author

pivovarit commented May 10, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants