Skip to content

nduyhai/shared-authentication

Folders and files

NameName
Last commit message
Last commit date
Mar 1, 2025
Nov 28, 2024
Dec 31, 2024
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Dec 31, 2024
Dec 31, 2024
Dec 31, 2024

Repository files navigation

shared-authentication

Auto config for multiple issuer oauth2

Setup docker

docker-compose up

Setup Keycloak

  1. Login Keycloak admin console: http://localhost:8080/ with user/pass inside docker-compose.yml
  2. Create new user for each realm (ex: user:user-2, pwd: 2)
  3. Retrieve access token for each user
curl --location 'localhost:8080/realms/merchant-auth/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=admin-cli \
--data-urlencode 'username=user-2' \
--data-urlencode 'password=2' \
--data-urlencode 'grant_type=password'
  1. Test api with access token
curl --location 'localhost:8081/greeting' \
--header 'Authorization: Bearer <access_token>'