This file contains hidden or 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
#!/bin/bash | |
set -e # Exit on error | |
# Variables | |
IMAGE_NAME="goechoapp" | |
TAG="latest" | |
KIND_CLUSTER_NAME="local-cluster" | |
DEPLOYMENT_YAML="goechoapp/deploy/echoapp.yaml" |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
set -o pipefail | |
# Set API URL | |
INV_HTTP_URL=${INV_HTTP_URL:-"http://localhost:8000"} | |
# Function to make requests and validate responses | |
make_request() { |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
set -o pipefail | |
# Set API URL | |
INV_HTTP_URL=${INV_HTTP_URL:-"http://localhost:8000"} | |
# Function to make requests and validate responses | |
make_request() { |
This file contains hidden or 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
FINAL=`curl -sk --data-raw '[{"id": '$manageUser',"name": "manage-users"},{"id": '$manageRealm',"name": "manage-realm"},{"id": '$manageClients',"name": "manage-clients"}]' --header "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" $KEYCLOAK_URL/admin/realms/$REALM/users/$svcUserId/role-mappings/clients/$realmMgmtClientId` | |
echo $FINAL |
This file contains hidden or 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
SVC=`curl -sk --header "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" $KEYCLOAK_URL/admin/realms/$REALM/clients/$kasClientId/service-account-user` | |
svcUserId=$(jq -r '.id' <<< $SVC) | |
echo $svcUserId |
This file contains hidden or 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
KAS=`curl -sk --header "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" $KEYCLOAK_URL/admin/realms/$REALM/clients?clientId=admin-sa` | |
kasClientId=$(jq -r '.[].id' <<< $KAS) |
This file contains hidden or 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
ROLES=`curl -sk --header "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" $KEYCLOAK_URL/admin/realms/$REALM/clients/$realmMgmtClientId/roles` | |
echo $ROLES | |
manageUser=$(jq -c '.[] | select( .name | contains("manage-users")).id' <<< $ROLES) | |
echo $manageUser | |
manageClients=$(jq -c '.[] | select( .name | contains("manage-clients")).id' <<< $ROLES) | |
echo $manageClients | |
manageRealm=$(jq -c '.[] | select( .name | contains("manage-realm")).id' <<< $ROLES) | |
echo $manageRealm |
This file contains hidden or 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
RE=`curl -sk --header "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" $KEYCLOAK_URL/admin/realms/$REALM/clients?clientId=realm-management` | |
realmMgmtClientId=$(jq -r '.[].id' <<< $RE) | |
echo $realmMgmtClientId |
This file contains hidden or 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
CREATE=`curl -sk --data-raw '{ | |
"authorizationServicesEnabled": false, | |
"clientId": "admin-sa", | |
"description": "admin-sa", | |
"name": "admin-sa", | |
"secret":"admin-sa", | |
"directAccessGrantsEnabled": false, | |
"serviceAccountsEnabled": true, | |
"publicClient": false, | |
"protocol": "openid-connect" |
This file contains hidden or 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_URL=http://0.0.0.0:8084 | |
REALM=test | |
CLIENT_ID=admin-cli | |
USERNAME=admin | |
PASS=admin | |
TOKEN_PATH="/realms/master/protocol/openid-connect/token" | |
RESULT=`curl -sk --data "grant_type=password&client_id=$CLIENT_ID&username=$USERNAME&password=$PASS" $KEYCLOAK_URL$TOKEN_PATH` | |
TOKEN=$(jq -r '.access_token' <<< $RESULT) | |
echo $TOKEN |
NewerOlder