https://github.com/nmasse-itix/programmez-article-sso
Code de mon article sur Red Hat SSO pour le magazine "Programmez !"
https://github.com/nmasse-itix/programmez-article-sso
Last synced: 2 months ago
JSON representation
Code de mon article sur Red Hat SSO pour le magazine "Programmez !"
- Host: GitHub
- URL: https://github.com/nmasse-itix/programmez-article-sso
- Owner: nmasse-itix
- Created: 2021-09-15T16:00:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-15T16:00:46.000Z (almost 4 years ago)
- Last Synced: 2025-02-12T11:16:25.913Z (4 months ago)
- Language: Java
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Code de l'article "Red Hat SSO" pour le magazine Programmez !
## Téléchargement
```sh
git clone https://github.com/nmasse-itix/programmez-article-sso.git
cd programmez-article-sso
./mvnw compile quarkus:dev
```## Requêtes d'exemple
```sh
http http://localhost:8080/pets/
http http://localhost:8080/pets/1
http http://localhost:8080/pets/2
http POST http://localhost:8080/pets name=Medor tag=dog
http PUT http://localhost:8080/pets/3 name=Brutus tag=dog
http DELETE http://localhost:8080/pets/3
```## Obtenir un jeton OpenID Connect
```sh
function get_token () {
curl -sk -XPOST -d grant_type=password -d scope=openid \
https://$SSO_HOSTNAME/auth/realms/$SSO_REALM/protocol/openid-connect/token \
-d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET \
--data-urlencode username=$LOGIN \
--data-urlencode password=$PASSWORD \
| jq -r 'if .access_token then .access_token else . end'
}SSO_HOSTNAME=keycloak-developpez.apps.itix-dev.ocp.itix
SSO_REALM=developpez
CLIENT_ID=client-rest
CLIENT_SECRET=375b9c88-3f42-44c5-8b65-ac501fd8db8f
LOGIN=john
PASSWORD=s3cr3tget_token
```## Passer le jeton OpenID Connect en paramètre
```sh
http http://localhost:8080/pets/ "Authorization:Bearer $(get_token)"
```