1

Suppose Two different customer having their respective client-id,client-secretkey,okta-domain. Based on my research on okta, I found that these parameters are to be set in application.properties file. How to set these parameter dynamically so that customer should redirect to their respective domain login page?

Edit :-

customer 1:-
a)DOMAIN :- dev-1234.okta.com
b)CLIENT_ID :- abcd
c)CLIENT_SECRET_KEY :- efgh

customer 2 :- 
a)DOMAIN :- dev-5678.okta.com
b)CLIENT_ID :- hijk
c)CLIENT_SECRET_KEY :- lmno

Suppose I select customer 2 , so customer 2's data should be set as environment variables(values in application.properties or application.yaml) ,but in spring boot there isn't any way to set environment variable dynamically.

Dhanraj
  • 1,162
  • 4
  • 18
  • 45

2 Answers2

0

You can use environment variables to set the properties for your respective apps. For example:

OKTA_OAUTH2_ISSUER=https://{yourOktaDomain}/oauth2/default \
OKTA_OAUTH2_CLIENT_ID={yourClientId} \
OKTA_OAUTH2_CLIENT_SECRET={yourClientSecret} ./mvn spring-boot:run
Matt Raible
  • 8,187
  • 9
  • 61
  • 120
0

Dhanraj, I'm not fully understanding your question, but Spring Boot has many options to configure variables. This is briefly covered here and more in-depth here.

I'd recommend looking at Spring Cloud Config too.

I've also seen folks write a custom Java Agent to configure System Properties before Spring loads (but this is sort of what cloud config does anyway.)

Brian Demers
  • 2,051
  • 1
  • 9
  • 12