jzheaux / resolutions

OAuth 2.0 Resource Server Demonstration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resolutions

The following is a simple REST API that authorizes requests using OAuth 2.0 Bearer tokens.

Each commit on the presentation branch correlates to the steps necessary to go from an unsecured REST API to the completed product.

To use, simply start up the Keycloak Authorization Server:

cd etc
docker-compose up

And the start up the resource server:

./mvnw spring-boot:run

You can obtain a token using the client credentials grant:

export TOKEN=`http :9999/token "client_id=client" "client_secret=secret" "grant_type=client_credentials" | jq -r .token`

And then query the endpoint:

http :8080/resolutions "Authorization: Bearer $TOKEN"

Add a resolution:

echo -n "Run for president" | http :8080/resolution

And complete it:

http PUT :8080/resolution/219168d2-1da4-4f8a-85d8-95b4377af3c1/complete

Enjoy!

About

OAuth 2.0 Resource Server Demonstration

License:Apache License 2.0


Languages

Language:Java 100.0%