OKTA_OAUTH2_ISSUER=https://{yourOktaDomain}/oauth2/default \
OKTA_OAUTH2_CLIENT-ID={clientId} \
OKTA_OAUTH2_CLIENT-SECRET={clientSecret} \
spring run idtoken.groovy
-
-
Save dogeared/d767fbb1226ecfe2540a7fd06fcdde63 to your computer and use it in GitHub Desktop.
Get an ID Token from Okta with Spring Boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.okta.spring:okta-spring-boot-starter:1.0.0') | |
@RestController | |
class Application { | |
@GetMapping('/') | |
String home(@org.springframework.security.core.annotation.AuthenticationPrincipal(expression = "idToken") org.springframework.security.oauth2.core.oidc.OidcIdToken idToken) { | |
idToken.getTokenValue() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment