Skip to content

Instantly share code, notes, and snippets.

@pschichtel
Created March 7, 2021 19:59
Show Gist options
  • Save pschichtel/c0c3f1f526ad7fb58955512cd5ad7743 to your computer and use it in GitHub Desktop.
Save pschichtel/c0c3f1f526ad7fb58955512cd5ad7743 to your computer and use it in GitHub Desktop.
Keycloak SAML helpers
keycloak_to_pem() {
input="$(mktemp)"
echo "-----BEGIN $1-----" > "$input"
echo "$2" >> "$input"
echo "-----END $1-----" >> "$input"
output="$(mktemp)"
case "$1" in
"CERTIFICATE")
openssl x509 -inform PEM -in "$input" -out "$output"
;;
"RSA PRIVATE KEY")
openssl rsa -in "$input" -out "$output"
;;
esac
cat "$output"
}
show_saml() {
base64 -d <<< "$1" | xmllint --format -
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment