Skip to content

sovanmukherjee/spring-boot-okta-saml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-okta-saml

1. Create a new developer account https://developer.okta.com
2. Sign up. You’ll receive an email to activate your account and change your temporary password.

alt text

3. Make sure you take write down your Okta URL after you’ve signed up. And sing in with user/password

alt text

4. After login you will get okta home page

alt text

5. Create New App

alt text

6. Click on Create App Integration

alt text

7. Select SAML 2.0

alt text

8. Provide application name

alt text

9. Enter the following SAML Settings:
  Single Sign-On URL: https://localhost:8080/saml/SSO
  Use this for Recipient URL and Destination URL: YES
  Audience URI: https://localhost:8080/saml/metadata

alt text

10. Click Next
      Select the following two options:
        •	I’m an Okta customer adding an internal app
        •	This is an internal app that we have created

alt text

11. Click the Finish button to continue.

alt text

And copy the Identity Provider metadata link. It will be use in spring boot application configuration.

alt text

the Identity Provider metadata link: https://dev-82083850.okta.com/app/exk1cnq4xcw6JcqQo5d7/sso/saml/metadata

12. The final setup step you’ll need is to assign people to the application. Before that you have to add people

From left side select Directory -> People -> Add Person

alt text

13. Assign to user

alt text

14. Click on Assign link

alt text

15. Click on the Assignments tab in your application and the Assign > Assign to People button. You’ll see a list of people with your account in it.

alt text

16. Now create a spring boot application. add spring-security-saml-dsl dependency in pom.
  <dependency>
    <groupId>org.springframework.security.extensions</groupId>
    <artifactId>spring-security-saml-dsl</artifactId>
    <version>1.0.0.M3</version>
  </dependency>
17. Add below property in application yml
  server.port = 8080
  server.ssl.enabled = true
  server.ssl.key-alias = spring
  server.ssl.key-store = classpath:saml/keystore.jks
  server.ssl.key-store-password = secret
  security.saml2.metadata-url = <your metadata url>
  
 - here metadata url: https://dev-82083850.okta.com/app/exk1cnq4xcw6JcqQo5d7/sso/saml/metadata
18. Create jks file through keytool in command prompt.
  keytool -genkey-v-keystore keystore.jks -alias spring -keyalg RSA -keysize 2048 -validity 10000

  Add password secret when prompted for a keystore password and Save this jks file into project /resources/saml/ directory
19. Start your application then enter https://localhost:8080/v1/students url in browser. It will redirect to Okta login page. Enter your okta credential and you should get success response data

alt text

alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published