a spring boot sample with spring security oauth2 authorization server and resource server
Go to file
RouxAntoine 55f73d4868
feature: spring authorization server and resource server sample
2023-08-15 20:49:39 +02:00
.mvn/wrapper feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
src feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
.gitignore feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
README.md feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
mvnw feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
mvnw.cmd feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00
pom.xml feature: spring authorization server and resource server sample 2023-08-15 20:49:39 +02:00

README.md

Getting Started

Obtaining an user access token

browse with navigator

http://localhost:8081/oauth2/authorize?response_type=code&client_id=client&redirect_uri=http://localhost:8081/login/oauth2/code/oidc-client&scope=openid%20profile%20read

$ read -s CODE
$ ACCESS_TOKEN=$(curl -v "http://localhost:8081/oauth2/token" --data-urlencode "grant_type=authorization_code" --data-urlencode "code=$CODE" --data-urlencode "redirect_uri=http://localhost:8081/login/oauth2/code/oidc-client" -H 'Content-Type: application/x-www-form-urlencoded' -u "client:secret" | jq -r .access_token | tee /dev/tty)

Obtaining a client credential (machine to machine jwt token)

$ curl -v "http://localhost:8081/oauth2/token" --data-urlencode "grant_type=client_credentials" --data-urlencode "code=$CODE" --data-urlencode "redirect_uri=http://localhost:8081/login/oauth2/code/oidc-client" -H 'Content-Type: application/x-www-form-urlencoded' -u "client:secret" | jq

Using access token

$ curl -v http://localhost:8081/ping -H "Authorization: Bearer $ACCESS_TOKEN"

oidc endpoint

http://localhost:8081/.well-known/openid-configuration http://localhost:8081/.well-known/oauth-authorization-server

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely: