Skip to content

Filter realm management roles from master OpenRemote tokens - #46

Open
wborn wants to merge 4 commits into
mainfrom
fix/master-token-role-filter
Open

wborn wants to merge 4 commits into
mainfrom
fix/master-token-role-filter

Conversation

@wborn

@wborn wborn commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Description

Master access tokens grow as realms are added because the master admin role inherits each realm’s Keycloak management client roles. With enough realms, those roles and their audiences can make tokens too large for proxy requests.

This PR packages a protocol mapper that filters realm-management client roles and their derived audiences from access tokens and introspection responses for the openremote client in the master realm. Realm roles, application client roles, and their audiences are preserved. Other clients and realms are unaffected.

Build changes

  • Package the mapper in the Keycloak image
  • Run ./gradlew test in a dedicated CI step before packaging, covering all discovered subprojects
  • Use the Keycloak 26.8.2 server BOM for both providers, bringing the registration listener’s compile dependencies from 26.6.4 into line with the image
  • Move the mapper’s test dependencies into the version catalog and remove unused fixed-issuer aliases
  • Centralize Maven Central in settings.gradle and disallow project-level repositories
  • Discover Gradle subprojects from build.gradle files, honor .buildignore, and exclude dependency and build-output directories

Rollout

Upgrade the Keycloak image before starting the Manager version that enables the mapper. The Manager attaches it when Keycloak advertises it. If the mapper is unavailable, the Manager leaves the client configuration alone and checks again on its next startup. Users receive smaller tokens on their next login or token refresh.

Validation

  • ./gradlew test passed locally and both provider JARs built
  • Verified that Gradle discovers all three existing subprojects and that nested projects and .buildignore behave as expected
  • Keycloak 26.8.2 discovered both providers during its build step

Companion Manager PR openremote/core#3603

Relates to openremote/core#3566

- Exclude realm management client roles and their derived audiences from access tokens and introspection responses
- Preserve realm roles, application client roles, and their audiences
- Package the mapper in the Keycloak image, run its tests in CI, and document the upgrade order

Relates to openremote/core#3566
- Adopt the Keycloak 26.8.2 server BOM for both providers and align the registration listener from 26.6.4 to 26.8.2 (https://github.com/keycloak/keycloak/releases/tag/26.8.2)
- Move the token filter’s JUnit and Mockito dependencies into the version catalog
- Remove unused catalog entries left by the fixed-issuer provider
- Centralize Maven Central in settings.gradle and disallow project-level repositories
@wborn
wborn requested a review from ebariaux December 2, 2026 15:02
wborn added 2 commits December 2, 2026 16:10
- Discover subprojects from build.gradle files and honor .buildignore
- Exclude generated and dependency directories from discovery
- Run all Gradle tests in a dedicated CI step before packaging
- Run the specifications with Spock 2.5 and Groovy 6.0.1 on JUnit Platform
- Replace JUnit Jupiter and Mockito with Spock assertions and built-in mocks
- Preserve all five test cases, including exclusions for other clients and realms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant