Skip to content

Latest commit

 

History

History
77 lines (38 loc) · 2.36 KB

SECURITY.md

File metadata and controls

77 lines (38 loc) · 2.36 KB

Players service SpringBoot - Security with OAuth 2.0 and OKTA

Testing-Running this repo

The code

Changes to the code (classes) are not necessary to add security to the API, adding some dependencies and setting OKTA makes it a secure API.

The Web Security Configurer Adapter (org.hillmerch.player.web.config.WebSecurityConfig)

Although no additional code is needed to add security, the WebSecurityConfig class can be used to customize security settings

Dependencies (pom.xml file)

  • SpringBoot security

      org.springframework.boot:spring-boot-starter-data-rest
      org.springframework.boot:spring-boot-starter-security
      org.springframework.security:spring-security-config
    
  • SpringBoot security OAuth 2.0

      org.springframework.security.oauth:spring-security-oauth2
    
  • OKTA

      com.okta.spring:okta-spring-boot-starter
    
  • SpringBoot security for testing

      org.springframework.security:spring-security-test:test
    

OAuth 2.0 - OKTA configurations

  • To use a OKTA is necessary

    • Create an application in OKTA

    • Update the okta properties in the file src/main/resources/application.properties

      spring.security.oauth2.client.registration.okta.client-id=<OKTA_CLIENT_ID> spring.security.oauth2.client.registration.okta.client-secret=<OKTA_CLIENT_SECRET> spring.security.oauth2.client.provider.okta.issuer-uri=https://<OKTA_ACCOUNT>.okta.com/oauth2/default