Skip to content

Commit 06b0bd2

Browse files
committed
some token exchange fiddling
Signed-off-by: Matthias Wessendorf <[email protected]>
1 parent f57b261 commit 06b0bd2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

build/keycloak.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ keycloak-setup-realm: ## Setup OpenShift realm with token exchange support
184184
MCP_CLIENT_RESPONSE=$$(curl -s -w "HTTPCODE:%{http_code}" -X POST "http://localhost:8090/admin/realms/openshift/clients" \
185185
-H "Authorization: Bearer $$TOKEN" \
186186
-H "Content-Type: application/json" \
187-
-d '{"clientId":"mcp-server","enabled":true,"publicClient":false,"standardFlowEnabled":true,"directAccessGrantsEnabled":true,"serviceAccountsEnabled":true,"authorizationServicesEnabled":false,"redirectUris":["*"],"defaultClientScopes":["groups"],"optionalClientScopes":["mcp:openshift"],"attributes":{"oauth2.device.authorization.grant.enabled":"false","oidc.ciba.grant.enabled":"false","backchannel.logout.session.required":"true","backchannel.logout.revoke.offline.tokens":"false"}}'); \
187+
-d '{"clientId":"mcp-server","enabled":true,"publicClient":false,"standardFlowEnabled":true,"directAccessGrantsEnabled":true,"serviceAccountsEnabled":true,"authorizationServicesEnabled":false,"redirectUris":["*"],"defaultClientScopes":["groups","mcp-server"],"optionalClientScopes":["mcp:openshift"],"attributes":{"oauth2.device.authorization.grant.enabled":"false","oidc.ciba.grant.enabled":"false","backchannel.logout.session.required":"true","backchannel.logout.revoke.offline.tokens":"false"}}'); \
188188
MCP_CLIENT_CODE=$$(echo "$$MCP_CLIENT_RESPONSE" | grep -o "HTTPCODE:[0-9]*" | cut -d: -f2); \
189189
if [ "$$MCP_CLIENT_CODE" = "201" ] || [ "$$MCP_CLIENT_CODE" = "409" ]; then \
190190
if [ "$$MCP_CLIENT_CODE" = "201" ]; then echo "✅ mcp-server client created"; \
@@ -194,7 +194,7 @@ keycloak-setup-realm: ## Setup OpenShift realm with token exchange support
194194
exit 1; \
195195
fi; \
196196
echo ""; \
197-
echo "Enabling token exchange for mcp-server..."; \
197+
echo "Enabling standard token exchange for mcp-server..."; \
198198
CLIENTS_LIST=$$(curl -s -X GET "http://localhost:8090/admin/realms/openshift/clients" \
199199
-H "Authorization: Bearer $$TOKEN" \
200200
-H "Accept: application/json"); \
@@ -203,15 +203,15 @@ keycloak-setup-realm: ## Setup OpenShift realm with token exchange support
203203
echo "❌ Failed to find mcp-server client"; \
204204
exit 1; \
205205
fi; \
206-
PERMS_RESPONSE=$$(curl -s -w "HTTPCODE:%{http_code}" -X PUT "http://localhost:8090/admin/realms/openshift/clients/$$MCP_CLIENT_ID/management/permissions" \
206+
UPDATE_CLIENT_RESPONSE=$$(curl -s -w "HTTPCODE:%{http_code}" -X PUT "http://localhost:8090/admin/realms/openshift/clients/$$MCP_CLIENT_ID" \
207207
-H "Authorization: Bearer $$TOKEN" \
208208
-H "Content-Type: application/json" \
209-
-d '{"enabled":true}'); \
210-
PERMS_CODE=$$(echo "$$PERMS_RESPONSE" | grep -o "HTTPCODE:[0-9]*" | cut -d: -f2); \
211-
if [ "$$PERMS_CODE" = "200" ]; then \
212-
echo "Token exchange permissions enabled"; \
209+
-d '{"clientId":"mcp-server","enabled":true,"publicClient":false,"standardFlowEnabled":true,"directAccessGrantsEnabled":true,"serviceAccountsEnabled":true,"authorizationServicesEnabled":false,"redirectUris":["*"],"defaultClientScopes":["groups","mcp-server"],"optionalClientScopes":["mcp:openshift"],"attributes":{"oauth2.device.authorization.grant.enabled":"false","oidc.ciba.grant.enabled":"false","backchannel.logout.session.required":"true","backchannel.logout.revoke.offline.tokens":"false","client.token.exchange.enabled":"true"}}'); \
210+
UPDATE_CLIENT_CODE=$$(echo "$$UPDATE_CLIENT_RESPONSE" | grep -o "HTTPCODE:[0-9]*" | cut -d: -f2); \
211+
if [ "$$UPDATE_CLIENT_CODE" = "204" ]; then \
212+
echo "Standard token exchange enabled for mcp-server client"; \
213213
else \
214-
echo "⚠️ Could not enable permissions (HTTP $$PERMS_CODE) - may need manual configuration"; \
214+
echo "⚠️ Could not enable token exchange (HTTP $$UPDATE_CLIENT_CODE)"; \
215215
fi; \
216216
echo ""; \
217217
echo "Getting mcp-server client secret..."; \

0 commit comments

Comments
 (0)