a spring boot sample with spring security
oauth2 authorization server and resource server
.mvn/wrapper | ||
src | ||
.gitignore | ||
mvnw | ||
mvnw.cmd | ||
pom.xml | ||
README.md |
Getting Started
Obtaining an user access token
browse with navigator
$ 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"
links
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:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Security
Guides
The following guides illustrate how to use some features concretely: