Skip to content

DTaaS keycloak custom claims#74

Open
sandrafosssoerensen wants to merge 52 commits intoINTO-CPS-Association:mainfrom
sandrafosssoerensen:dtaas-keycloak-custom-claims
Open

DTaaS keycloak custom claims#74
sandrafosssoerensen wants to merge 52 commits intoINTO-CPS-Association:mainfrom
sandrafosssoerensen:dtaas-keycloak-custom-claims

Conversation

@sandrafosssoerensen
Copy link
Copy Markdown

Keycloak Protocol Mappers - PR Overview

This is the short summary of what was implemented in this repository for the
Keycloak mapper work.

What Changed

  1. Added an idempotent configurator script:
    • workspaces/test/dtaas/keycloak/configure_keycloak_rest.py
  2. Script now configures both custom claims used by DTaaS:
    • profile (from user attribute)
    • groups (from group membership)
  3. Added support for two mapper placement modes:
    • shared client scope
    • direct client mappers
  4. Set shared scope as the default mode.

Final Claim Decisions

Included:

  • sub
  • name
  • preferred_username
  • profile
  • groups

Not implemented (by design):

  • sub_legacy (GitLab-specific)
  • groups_direct (GitLab-specific)
  • https://gitlab.org/claims/groups/owner (GitLab-specific and not needed)

Scope Mode

Default behavior is now shared scope:

KEYCLOAK_USE_SHARED_SCOPE=true
KEYCLOAK_SHARED_SCOPE_NAME=your-shared-scope-name

Optional direct-client mode:

KEYCLOAK_USE_SHARED_SCOPE=false

How To Apply

cd workspaces/test/dtaas/keycloak
py configure_keycloak_rest.py --env-file ../config/.env

Verification Checklist

  1. In Keycloak client/scopes, profile and groups mappers exist.
  2. User is assigned to a Keycloak group (for groups claim to appear).
  3. User has profile attribute (or script populated it).
  4. userinfo contains expected claims (profile, groups, preferred_username).

prasadtalasila and others added 30 commits December 19, 2025 16:38
Moved  ./dtaas to ./workspaces/test/dtaas

This changes the semantic structure of the repository basing everything on hte workspaces as the focal point.
Specifically the two config example files, client.js.example and conf.example
…e.traefik.secure.tls.yml

Repository contains two different compose files for the multiuser tls setup after merging. Both are kept for now. Expectation is that only one will stand after testing.
- Changed paths in README to correspond with new structure.
- Added notes about running all commands from the workspaces/ directory to README.
- Changed all instances of "dtaas-user" to "user1" in README to correspond to basic compose file.
- Removed name for the entire basic compose file in favor of explicitly setting the container name. Now ends up with same name as when run with basic docker command.
- Fixed an error in the path values for the context: and dockerfile: entries in compose.yml.
- Fixed a typo in the path structure for the firefox resources.
…cture.

Also fixes path values for the context: and dockerfile: entries in the user1 service in compose.traefik.yml
- Changed paths in both files to match new project structure.
- Removed superflous sections from TRAEFIK_SECURE.md
- Partially restructured CONFIGURATION.md, adding sections on creating the environment variable config file and changing user names.
@prasadtalasila
Copy link
Copy Markdown
Contributor

@sandrafosssoerensen Thanks for the PR. The code quality can be improved by using the following conventions.

  1. File length limited to 250 lines
  2. Function length limited to 25 lines
  3. Separation of code into workspaces/test/dtaas/keycloak/src and workspaces/test/dtaas/keycloak/test

Please see this example. You can use src instead of using something like dtaas_services

@sandrafosssoerensen
Copy link
Copy Markdown
Author

sandrafosssoerensen commented Apr 13, 2026

@prasadtalasila Thank you. This makes sense. I have also tried to ommit the "# pylint: disable " that I had in some files alongside my update. This required alot of changes. But tell me if it still needs refactoring. Thanks in advance.

Update: Ican see that lint scripts is failing. I will fix this after the meeting. Its related to flake8, which I researched to be used in order to enforce style consistency and check code quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants