get_token is working now w/ burnettk
This commit is contained in:
parent
11f9b7142b
commit
3246adc31c
|
@ -48,23 +48,27 @@ token=$(jq -r '.access_token' <<< "$result")
|
||||||
|
|
||||||
if [[ "$token" != 'null' ]]; then
|
if [[ "$token" != 'null' ]]; then
|
||||||
echo "token: $token"
|
echo "token: $token"
|
||||||
echo "getting user info"
|
|
||||||
# curl -s "http://localhost:7002/realms/spiffworkflow/protocol/openid-connect/userinfo" -H "Authorization: Bearer $token"
|
# curl -s "http://localhost:7002/realms/spiffworkflow/protocol/openid-connect/userinfo" -H "Authorization: Bearer $token"
|
||||||
resource_result=$(curl -s "http://localhost:7002/realms/spiffworkflow/authz/protection/resource_set?matchingUri=true&deep=true&max=-1&exactName=false&uri=%2Fprocess-models%2Fcategory_number_one%2Fprocess-model-with-repeating-form" -H "Authorization: Bearer $token")
|
resource_result=$(curl -s "http://localhost:7002/realms/spiffworkflow/authz/protection/resource_set?matchingUri=true&deep=true&max=-1&exactName=false&uri=%2Fprocess-models%2Fcategory_number_one%2Fprocess-model-with-repeating-form" -H "Authorization: Bearer $token")
|
||||||
|
|
||||||
|
resource_ids=$(jq -r '.[] | ._id' <<<"$resource_result" || echo '')
|
||||||
|
if [[ -z "$resource_ids" || "$resource_ids" == "null" ]]; then
|
||||||
|
>&2 echo "ERROR: Could not find the resource id from the result: ${resource_result}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for resource_id in $resource_ids ; do
|
||||||
# # -H "Authorization: Basic $basic_auth" \
|
basic_auth=$(echo -n "${CLIENT_ID}:${CLIENT_SECRET}" | base64 -w0)
|
||||||
# basic_auth=$(echo -n "${CLIENT_ID}:${CLIENT_SECRET}" | base64 -w0)
|
curl -s -X POST "$KEYCLOAK_URL" "$INSECURE" \
|
||||||
# # -H "Authorization: Bearer $token" \
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||||
# curl -s -X POST "$KEYCLOAK_URL" "$INSECURE" \
|
-H "Authorization: Basic $basic_auth" \
|
||||||
# -H "Content-Type: application/x-www-form-urlencoded" \
|
-d "audience=${CLIENT_ID}" \
|
||||||
# -H "Authorization: Basic $basic_auth" \
|
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:uma-ticket" \
|
||||||
# -d "audience=${CLIENT_ID}" \
|
-d "permission=${resource_id}" \
|
||||||
# --data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:uma-ticket" \
|
-d "subject_token=${token}" \
|
||||||
# -d "permission=e294304c-796e-4c56-bdf2-8c854f65db59" \
|
| jq .
|
||||||
# -d "subject_token=${token}" \
|
done
|
||||||
# | jq .
|
else
|
||||||
else
|
echo "Failed auth result: $result"
|
||||||
echo "Failed auth result: $result"
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue