Add authenticated endpoint.
This commit is contained in:
22
scripts/get_jwks.bash
Executable file
22
scripts/get_jwks.bash
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Key the JWKS
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
||||
function main() {
|
||||
local gateway_address
|
||||
gateway_address=$(tf output -raw gateway_address)
|
||||
curl "https://$gateway_address/.well-known/jwks.json"
|
||||
}
|
||||
|
||||
function tf() {
|
||||
terraform -chdir="$DIR/../terraform" "${@}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
main "${@}"
|
||||
24
scripts/hit_protected_endpoint.bash
Executable file
24
scripts/hit_protected_endpoint.bash
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Hit an endpoint that requires a valid JWT.
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
||||
function main() {
|
||||
local jwt
|
||||
jwt=$(cd "$DIR"/../api_server && poetry run python -m api_server.local_generate_long_lived_token)
|
||||
local gateway_address
|
||||
gateway_address=$(tf output -raw gateway_address)
|
||||
curl -H "Authorization: Bearer $jwt" "https://$gateway_address/some_protected_endpoint"
|
||||
}
|
||||
|
||||
function tf() {
|
||||
terraform -chdir="$DIR/../terraform" "${@}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
main "${@}"
|
||||
Reference in New Issue
Block a user