Created
September 5, 2019 23:55
-
-
Save rogmanster/931b6ae938d1ff6928aeb150fc704496 to your computer and use it in GitHub Desktop.
Vault JWT Auth Method - API
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
{ | |
"oidc_discovery_url":"https://dev-2sqiyoyv.auth0.com/", | |
"bound_issuer":"https://dev-2sqiyoyv.auth0.com/", | |
"default_role":"demo" | |
} |
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
{ | |
"role_type":"jwt", | |
"bound_audiences":"https://vault.com", | |
"user_claim":"sub", | |
"policies":"my-policy", | |
"ttl":"1h" | |
} |
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
{ | |
"data": { | |
"username": "milli", | |
"password": "vanilli" | |
} | |
} |
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
{ | |
"policy": "path \"secret/metadata\" { capabilities = [\"list\"]} \npath \"secret/data/mycred\" { capabilities = [\"read\"]}" | |
} |
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
#configure kv secret | |
curl \ | |
--header "X-Vault-Token: ${VAULT_TOKEN}" \ | |
--request POST \ | |
--data @mycred.json \ | |
http://localhost:8200/v1/secret/data/mycred | jq | |
#enable jwt auth | |
curl \ | |
--header "X-Vault-Token: $VAULT_TOKEN" \ | |
--request POST \ | |
--data '{"type": "jwt"}' \ | |
http://127.0.0.1:8200/v1/sys/auth/jwt | |
#configure jwt auth method | |
curl \ | |
--header "X-Vault-Token: ${VAULT_TOKEN}" \ | |
--request POST \ | |
--data @jwt_config.json \ | |
http://localhost:8200/v1/auth/jwt/config | jq | |
#configure jwt role | |
curl \ | |
--header "X-Vault-Token: ${VAULT_TOKEN}" \ | |
--request POST \ | |
--data @jwt_role.json \ | |
http://localhost:8200/v1/auth/jwt/role/demo | jq | |
#apply policy | |
curl \ | |
--request POST \ | |
--header "X-Vault-Token: ${VAULT_TOKEN}" \ | |
--data @policy.json \ | |
http://localhost:8200/v1/sys/policy/my-policy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment