summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2022-04-14 10:19:55 -0600
committermo khan <mo@mokhan.ca>2022-04-14 10:19:55 -0600
commita6b7842ff4196901225c82b8bf4a4117a2197290 (patch)
tree7555ef673df69150141c8380c4a5a08a85a2babb
parenta136d208d5d385af639f131651bd5c764aa2aa58 (diff)
update bin scripts to accept a target host
-rwxr-xr-xsrc/oidc/bin/00_metadata5
-rwxr-xr-xsrc/oidc/bin/01_authz_code3
-rwxr-xr-xsrc/oidc/bin/02_authz_code_token_request4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/oidc/bin/00_metadata b/src/oidc/bin/00_metadata
index 857fa40..7d57dad 100755
--- a/src/oidc/bin/00_metadata
+++ b/src/oidc/bin/00_metadata
@@ -2,6 +2,7 @@
set -e
cd "$(dirname "$0")/.."
+HOST="${HOST:-http://localhost:8282}"
-curl -s "http://localhost:8282/.well-known/openid-configuration" | jq '.'
-curl -s "http://localhost:8282/.well-known/jwks.json" | jq '.'
+curl -s "${HOST}/.well-known/openid-configuration" | jq '.'
+curl -s "${HOST}/.well-known/jwks.json" | jq '.'
diff --git a/src/oidc/bin/01_authz_code b/src/oidc/bin/01_authz_code
index a3fadd4..3f6c44b 100755
--- a/src/oidc/bin/01_authz_code
+++ b/src/oidc/bin/01_authz_code
@@ -2,5 +2,6 @@
set -e
cd "$(dirname "$0")/.."
+HOST="${HOST:-http://localhost:8282}"
-curl -s "http://localhost:8282/authorize?response_type=code&scope=openid&client_id=f00d&state=potatoe&redirect_uri=http://example.org/callback"
+curl -s "${HOST}/authorize?response_type=code&scope=openid&client_id=client_id&state=potatoe&redirect_uri=http://example.org/callback"
diff --git a/src/oidc/bin/02_authz_code_token_request b/src/oidc/bin/02_authz_code_token_request
index e832701..91bbcdb 100755
--- a/src/oidc/bin/02_authz_code_token_request
+++ b/src/oidc/bin/02_authz_code_token_request
@@ -2,6 +2,7 @@
set -e
cd "$(dirname "$0")/.."
+HOST="${HOST:-http://localhost:8282}"
if [ $# -eq 0 ]; then
echo "Usage:"
@@ -10,9 +11,8 @@ if [ $# -eq 0 ]; then
fi
CODE="${1}"
-
curl -s \
-u "client_id:client_secret" \
--basic \
-d "grant_type=authorization_code&code=${CODE}&redirect_uri=http://example.org/callback" \
- "http://localhost:8282/token"
+ "${HOST}/token"