8000 Adds a migration documentation for token exchange v1 to v2 (external-to-internal) by jimmychakkalakal · Pull Request #55425 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Adds a migration documentation for token exchange v1 to v2 (external-to-internal) - #55425

Draft
jimmychakkalakal wants to merge 1 commit into
keycloak:mainfrom
jimmychakkalakal:issues/47626-migration-token-exchange-v1-v2-external-2-internal
Draft

jimmychakkalakal wants to merge 1 commit into
keycloak:mainfrom
jimmychakkalakal:issues/47626-migration-token-exchange-v1-v2-external-2-internal

Conversation

@jimmychakkalakal
Copy link
Copy Markdown
Contributor

Adds a migration documentation for token exchange v1 to v2 (external-to-internal)

Closes #47626

…to-internal)

Closes keycloak#47626

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.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.

🟢 Approval recommended

No active review issues were identified for the documentation-only migration guidance and related cross-links.

No open issues 🎉

What changed in this PR

Adds documentation for migrating legacy external-to-internal Token Exchange V1 to JWT Authorization Grant or identity brokering, addressing issue #47626. No runtime code changes are included.

Changes:

  • Explains migration paths, including combining Standard Token Exchange V2 with JWT Authorization Grant across realms.
  • Documents user provisioning, assertion requirements, Google support, and refresh-token differences, with request examples and a validation checklist.
  • Links the migration guide from the existing token exchange and JWT Authorization Grant guides.
File Description
docs/​guides/​securing-apps/​token-exchange.adoc Links legacy external-to-internal exchange documentation to the migration guide.
docs/​guides/​securing-apps/​token-exchange-migration-external-internal.adoc Adds migration paths, configuration steps, request examples, and validation guidance.
docs/​guides/​securing-apps/​jwt-authorization-grant.adoc Links to migration guidance on user linking and token handling.

Review effort: Balanced

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.

🟢 Approval recommended

No active review issues remain for the documentation guiding migration from legacy external-to-internal token exchange.

No open issues 🎉

Review effort: Balanced

@mposolda mposolda self-assigned this Nov 24, 2026
@mposolda mposolda 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.

@jimmychakkalakal Thanks a lot for the PR!

As mentioned in the #55411 (review) , it can be better to use single "migration guide" and use individual use-cases . Which means that this PR may need to possibly wait until #55411 is merged? But I am reviewing anyway even if this PR may need some rebase later...

IMO also worth to mention that JWT authorization grant and identity chaining does not depends on fine-grained admin permissions anymore (TE V1 depends on that). Something similar like you mentioned in the other PR for internal-internal #55411 ?

Few other minor comments inline

Legacy external-internal exchange can import a new user into the destination realm and can return a refresh token.
These behaviors differ from JWT Authorization Grant, so migration involves reviewing user provisioning and token handling as well as changing the request parameters.

NOTE: This guide covers only external-to-internal token exchange (exchanging a token from an external identity provider for a {project_name} token).
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.

Maybe this NOTE is not needed and can be removed? Especially considering that this would be sub-chapter of the "Migration" chapter, which would contain all the other migrations for other TE use-cases, and hence it is maybe implicit that other cases are covered in the other subchapter?

|Complete identity brokering through the browser, or provision the local account and federated identity link before using JWT Authorization Grant. See <<_external-internal-migration-users,User creation and account linking>>.

|The application has only an opaque external access token.
|That token cannot be submitted as a JWT assertion. Use browser-based link:{adminguide_link}#identity_broker[Identity Brokering] to obtain a {project_name} token, or obtain a suitable signed JWT from an issuer supported by JWT Authorization Grant.
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.

Suggested change
|That token cannot be submitted as a JWT assertion. Use browser-based link:{adminguide_link}#identity_broker[Identity Brokering] to obtain a {project_name} token, or obtain a suitable signed JWT from an issuer supported by JWT Authorization Grant.
|That token cannot be submitted as a JWT assertion. Use browser-based link:{adminguide_link}#_identity_broker[Identity Brokering] to obtain a {project_name} token, or obtain a suitable signed JWT from an issuer supported by JWT Authorization Grant.

Seems correct link is #_identity_broker?

The assertion must be a signed JWT that the configured identity provider can validate.
An arbitrary external access token does not necessarily meet the grant's requirements.

For the OIDC and generic JWT Authorization Grant provider types, check the following:
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.

it is maybe better to not list the requirements for the claims, but rather link the corresponding section ( https://www.keycloak.org/securing-apps/jwt-authorization-grant ), which mentions those requirements?

In general, it is better to link existing docs instead of "copy docs" to avoid having same docs on more places (as same docs on more places introduces the risk that when some requirement is changed in the future, there are multiple places of the documentation, which needs to be changed, which increases the risk that some place in the documentation would be forgotten...)


== Update session and response handling

JWT Authorization Grant returns an access token and creates a transient user session.
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.

Maybe worth to mention in more details (maybe with some note) what exactly is transient user session as it may not be clear for the reader. Maybe with the link to the corresponding section of admin guide - https://www.keycloak.org/docs/latest/server_admin/index.html#_transient-session

@mposolda
mposolda marked this pull request as ready for review November 25, 2026 12:44
@mposolda
mposolda requested a review from a team as a code owner November 25, 2026 12:44
@jimmychakkalakal
Copy link
Copy Markdown
Contributor Author

Tracking the review updates while this PR waits for #55411 to merge.

The updates are pushed to the working branch issues/47626-external-internal-review-stacked, currently at a18395a073. This branch is stacked on #55411's current head, 2bb8b2f1b4013218ac3c43cce42f8e5d98267d9e. This PR's original branch, issues/47626-migration-token-exchange-v1-v2-external-2-internal, remains at b63154d214a0188150edb63cd09bcd691b39cc06.

The prepared changes move external-internal migration into the shared migration guide, remove the redundant scope NOTE, replace duplicated assertion requirements and Google validation details with references to the JWT Authorization Grant guide, verify the Identity Brokering links, and add the FGAP clarification and transient-session NOTE requested in review.

Further work can continue on the working branch. After #55411 merges, rebase it onto updated upstream main using the recorded dependency boundary:

git switch issues/47626-external-internal-review-stacked
git fetch upstream
git rebase --onto upstream/main 2bb8b2f1b4013218ac3c43cce42f8e5d98267d9e

This replays only the commits after #55411's recorded head: currently a18395a073, plus any additional commits made on the working branch. It also handles #55411 being squash-merged. Once the rebased diff is reviewed and the documentation is rebuilt, update this PR's original branch with the rebased result.

Validation completed for the prepared changes: documentation package build, docs-module Spotless, generated heading and link checks, and shell syntax checks for the curl examples.

@jimmychakkalakal
jimmychakkalakal marked this pull request as draft November 26, 2026 14:58
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.

Migrating from token exchange v1 to v2 (external-internal)

3 participants

0