Skip to content

Add client type support to Admin API v2#50895

Open
arnabnandy7 wants to merge 14 commits into
keycloak:mainfrom
arnabnandy7:feature/v2-client-types
Open

Add client type support to Admin API v2#50895
arnabnandy7 wants to merge 14 commits into
keycloak:mainfrom
arnabnandy7:feature/v2-client-types

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Closes #50894

This adds client-type support when creating and updating clients through Admin API v2.

The v2 client creation flow now:

  • exposes the client type in the v2 representation and generated OpenAPI schema
  • augments newly created clients using the configured client type
  • preserves omitted values controlled by the client type
  • distinguishes omitted creation fields from explicit null or empty updates
  • delegates explicit updates to client-type validation
  • handles typed service-account clients consistently
  • exposes the requested type to client policy contexts

Regression coverage includes creating a minimal service-account client and clearing mutable typed-client properties through a merge patch.

The protocol-default changes remain in #50801 and are intentionally excluded from this PR.

Apply configured client types during v2 client creation while preserving omitted type-controlled values and explicit update semantics.

Closes keycloak#50894

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 14, 2026 18:08
@arnabnandy7
arnabnandy7 requested review from a team as code owners July 14, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds client-type support to Admin API v2 client creation and updates.

Changes:

  • Exposes client type through representations and OpenAPI.
  • Applies client-type defaults while preserving omitted fields.
  • Adds typed-client creation and merge-patch tests.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
InteropTest.java Adds typed-client regression tests.
DefaultClientService.java Integrates client-type handling.
OIDCClientModelMapper.java Refactors authentication mapping.
ClientModelMapper.java Adds field-exclusion mapping.
BaseClientModelMapper.java Implements excluded-field support.
SAMLClientRepresentation.java Tracks explicit logout updates.
OIDCClientRepresentation.java Tracks explicit OIDC fields.
BaseRepresentation.java Records explicitly set fields.
BaseClientRepresentation.java Adds the client type property.
openapi.json Documents the client type schema.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 14, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 14, 2026 19:10
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7
arnabnandy7 force-pushed the feature/v2-client-types branch from 51c824e to b3f3ea1 Compare July 14, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 14, 2026 19:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:54
…ypes

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>

# Conflicts:
#	rest/admin-v2/services/src/main/java/org/keycloak/services/client/DefaultClientService.java
#	rest/admin-v2/tests/src/test/java/org/keycloak/tests/admin/client/v2/InteropTest.java
Copilot AI review requested due to automatic review settings July 21, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings July 21, 2026 17:57
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Copilot AI review requested due to automatic review settings July 21, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 21, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 21, 2026 20:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Copilot AI review requested due to automatic review settings July 21, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

rest/admin-v2/tests/src/test/java/org/keycloak/tests/admin/client/v2/InteropTest.java:398

  • This regression only patches fields that are mutable in the oidc type, so it does not exercise the new client-type rejection path or parameterized error response. Add a typed service-account patch that explicitly removes SERVICE_ACCOUNT (or changes another fixed field) and assert the 400 response includes the controlled option in params.
            getClientsApi().client(client.getClientId()).patchClient(
                    new ByteArrayInputStream(mapper.writeValueAsBytes(patch)));

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.MultipleTabsLoginTest#multipleTabsParallelLoginTestWithAuthSessionExpiredAndRequiredAction

Keycloak CI - Forms IT (chrome)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

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

Labels

flaky-test status/hold PR should not be merged. On hold for later.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add v2 client handling for client types feature.

3 participants