keycloak-service-identity
Skill2 starsChanged 4 months agoApache-2.0View on GitHub
Provision or rotate a local Keycloak confidential service identity and its AI Governance Control Plane authorization without treating Keycloak claims as permissions.
- Reads credentials
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- console/AGENTS.mdAGENTS.md
- keycloak-postgres/AGENTS.mdAGENTS.md
- api-changeSkill
- domain-featureSkill
- governance-policySkill
- model-runtime-capability-profileSkill
- tenant-isolationSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when adding, rotating, or repairing a machine identity that calls AI Governance Control Plane.
- Very specific: line 19
Read root AGENTS.md, keycloak-postgres/AGENTS.md, and the scoped tenancy/API instructions for every control-plane layer changed.
- Distinctive: line 24
Keep Keycloak limited to identity and token-scope claims.
- Very specific: line 31
Add a dedicated confidential client to keycloak-postgres/keycloak/ai-governance-realm.json with a secret supplied through …
- Distinctive: line 36
Keep tenant claims limited to the intended organization and project.
- Very specific: line 46
Read keycloak-postgres/Keycloak Authentication Setup.md for the local topology and docs/architecture/KEYCLOAK_INTEGRATION.md before …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Keycloak Service Identity
Use this skill when adding, rotating, or repairing a machine identity that calls AI Governance Control Plane. It does not apply to browser users or to changing the semantic permissions of a domain feature.
Keycloak authenticates the workload. AI Governance Control Plane owns the
organization membership, project scope, roles, and permissions. The runtime
actor ID is always the validated Keycloak service-account user's immutable
sub; never invent it, copy a client UUID, or accept it from the caller.
Workflow
- Read root
AGENTS.md,keycloak-postgres/AGENTS.md, and the scoped tenancy/API instructions for every control-plane layer changed. - Inspect the closest existing confidential client, its claim mappers, and
scripts/keycloak/get-service-account-actorids.shbefore editing the realm import contract. - Keep Keycloak limited to identity and token-scope claims. Add membership and the least-privilege project role through the control plane.
- Validate the realm import and Compose configuration, then prove both the intended authenticated request and a denied, ungranted operation.
Local realm contract
- Add a dedicated confidential client to
keycloak-postgres/keycloak/ai-governance-realm.jsonwith a secret supplied throughkeycloak-postgres/.env.keycloak/Compose interpolation. Enable service accounts and client credentials; disable browser and direct-grant flows unless they are explicitly needed. - Keep tenant claims limited to the intended organization and project. Claims constrain scope only; they do not grant control-plane permissions.
- Extend
scripts/keycloak/get-service-account-actorids.shto resolve the client’s service-account user through the Keycloak Admin API and write an appropriately namedAI_GOVERNANCE_*_ACTOR_IDto the ignored generated env file. The generated file is the only local hand-off of thatsub. - Provision an active membership and the narrowest project-scoped role in the control plane from that generated environment variable. Do not use Keycloak realm/client roles as an authorization substitute.
Read keycloak-postgres/Keycloak Authentication Setup.md for the local
topology and docs/architecture/KEYCLOAK_INTEGRATION.md before changing token
claims or tenant-context behavior.
Realm resets and identity rotation
Keycloak imports the realm only into a new Keycloak PostgreSQL volume. A fresh
realm gives every service account a new sub, so first regenerate the actor-ID
file, then provision the new membership and role. Retire the previous
control-plane memberships through the supported membership API/UI after the new
identity has been validated; do not delete rows directly from persistence.
For an intentional local realm reset, document its scope and use the
keycloak-postgres Compose project only. Never remove unrelated platform data
or print, commit, or persist client secrets and access tokens.
Verification
Validate the realm JSON and Compose configuration, start from a clean local
realm when the import changed, acquire a client-credentials token, and perform
an authenticated call under the expected organization and project. Include a
negative authorization check for an ungranted permission or another project.
The workload must refresh an expiring token and retry a 401 only once.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

