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

Use dotenv to load Okta settings #22

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .okta.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ISSUER=${CLI_OKTA_ISSUER}
CLIENT_ID=${CLI_OKTA_CLIENT_ID}
CLIENT_SECRET=${CLI_OKTA_CLIENT_SECRET}
5 changes: 3 additions & 2 deletions .okta/sample-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ oauthClient:
applicationType: web

directions: |+2
Okta configuration written to: src/main/resources/application.properties
Don't EVER commit src/main/resources/application.properties into source control
Okta configuration written to .okta.env.

Add this file to .gitignore!

Run this application with:

Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<artifactId>okta-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>me.paulschwarz</groupId>
<artifactId>spring-dotenv</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
okta.oauth2.issuer=${CLI_OKTA_ISSUER}
okta.oauth2.client-id=${CLI_OKTA_CLIENT_ID}
okta.oauth2.client-secret=${CLI_OKTA_CLIENT_SECRET}
okta.oauth2.issuer=${env.ISSUER}
okta.oauth2.client-id=${env.CLIENT_ID}
okta.oauth2.client-secret=${env.CLIENT_SECRET}
.env.filename=.okta.env