Created
March 7, 2021 19:59
-
-
Save pschichtel/c0c3f1f526ad7fb58955512cd5ad7743 to your computer and use it in GitHub Desktop.
Keycloak SAML helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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