Skip to content

Instantly share code, notes, and snippets.

View rolandyoung's full-sized avatar

Roland Young rolandyoung

  • ITRS Group Ltd
  • UK
View GitHub Profile
@rolandyoung
rolandyoung / verifyToken.sh
Last active July 8, 2022 11:16
Using openssl to verify a JWT from Keycloak
#!/bin/bash
# tested with OpenSSL 1.0.1e-fips on Centos 6
# Note hardcoded Keycloak URL and credentials.
# Keycloak public key is in ATS-ci.key.pem with -----BEGIN PUBLIC KEY----- (etc)
assert() { if [[ $1 != $2 ]]; then echo "assert" $3; exit; fi }
url=http://192.168.10.221:8088/auth/realms/ATS-ci/protocol/openid-connect/token
resp=$(curl -X POST $url \