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

Replace Spring Security OAuth with Okta Spring Boot Starter #9

Closed
wants to merge 6 commits into from

Conversation

mraible
Copy link
Contributor

@mraible mraible commented Feb 6, 2018

DO NOT MERGE. This PR only exists to demonstrate an issue in the Okta Spring Boot Starter.

It seems like it should be possible to reduce the number of properties needed for Spring Security OAuth by simply adding the Okta Spring Boot Starter. Unfortunately, it does not work.

To reproduce the issue. Create a ~/.okta.env file with your settings for an Okta Web app.

export SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI="https://{yourOktaDomain}.com/oauth2/default/v1/token"
export SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI="https://{yourOktaDomain}.com/oauth2/default/v1/authorize"
export SECURITY_OAUTH2_RESOURCE_USER_INFO_URI="https://{yourOktaDomain}.com/oauth2/default/v1/userinfo"
export SECURITY_OAUTH2_RESOURCE_TOKEN_INFO_URI="https://{yourOktaDomain}.com/oauth2/default/v1/introspect"
export SECURITY_OAUTH2_CLIENT_CLIENT_ID="{yourClientId}"
export SECURITY_OAUTH2_CLIENT_CLIENT_SECRET="{yourClientSecret}"

Clone this project and checkout the oauth branch:

git clone git@github.com:oktadeveloper/spring-boot-microservices-example.git
cd spring-boot-microservices-example
git checkout oauth

Source your app settings and run each app:

source ~/.okta.env
./run.sh

You should be able to log in at http://localhost:8081 and see data from the beer-catalog-service at http://localhost:8081/good-beers.

Now, check out the oauth-okta branch and add your client ID and secret to ~/.okta.env.

export OKTA_OAUTH2_CLIENTID="{yourClientId}"
export OKTA_OAUTH2_CLIENTSECRET="{yourClientSecret}"

Run the following commands to restart everything with the new settings:

killall java
source ~/.okta.env
./run.sh

You'll be able to log in at http://localhost:8081, but you won't be able to access http://localhost:8081/good-beers.

@mraible mraible closed this May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant