Skip to content

Read the anonymous profile tracker from the anonymous user in the identity context - #27

Open
SujanSanjula96 wants to merge 1 commit into
wso2-extensions:mainfrom
SujanSanjula96:cds-improve-unify-architecture
Open

SujanSanjula96 wants to merge 1 commit into
wso2-extensions:mainfrom
SujanSanjula96:cds-improve-unify-architecture

Conversation

@SujanSanjula96

@SujanSanjula96 SujanSanjula96 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The anonymous user unification during registration uses the http://wso2.org/claims/cdsProfile user claim to carry the anonymous profile tracker. A user claim is not a good carrier for a value that is only needed while the user is onboarded.

Related to wso2/identity-customer-data-service#287

Goals

Take the anonymous profile tracker from the identity context, so that the flow engine registration and the legacy self registration use one approach.

Approach

  • IdentityEventHandler (POST_ADD_USER) reads the tracker from IdentityContext.getAnonymousUser().getAnonymousProfileTracker().
  • If the identity context has no anonymous user or no tracker, the handler uses the value of the cdsProfile claim, as before.
  • The event handler bundle imports org.wso2.carbon.identity.core.context and org.wso2.carbon.identity.core.context.model.

Dependency: this change needs a framework release that contains wso2/carbon-identity-framework#8190. Bump carbon.identity.framework.version in the root pom.xml to that release before this PR is merged.

Release note

The CDS identity event handler takes the anonymous profile tracker of a new user from the identity context, with the cdsProfile claim as a fallback.

Automation tests

  • Unit tests: IdentityEventHandlerTest adds 4 cases (tracker from the anonymous user, fallback to the claim when the anonymous user has no tracker, fallback when there is no anonymous user, profile sync when there is no tracker). All 19 tests of the module pass.
  • Integration tests: N/A.

Runtime verification

Tested on a 7.4.0 snapshot pack with the related PRs applied and with a mock CDS endpoint that records the sync requests. The profileCookie value that CDS got for POST_ADD_USER:

Case Input Result
Self registration API anonymous_profile_tracker property only property value
Self registration API cdsProfile claim only claim value
Self registration API no tracker no tracker (profile sync)
Self registration API claim and property with different values property value
Flow engine registration same tracker in the first and the next request input value
Flow engine registration tracker in the first request only no tracker
Flow engine registration different tracker in the next request no tracker
Flow engine registration tracker and cdsProfile claim as inputs in the first request only no tracker, and no claim
Flow engine registration tracker only in a later request no tracker

Security checks

Related PRs

Test environment

JDK 21, macOS.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bdbc13c1-53a1-44cc-87b8-26d0e4e39558
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ntity context

The POST_ADD_USER handler reads the tracker from the anonymous user in the
identity context. If the identity context has none, it uses the cdsProfile
claim, as before.

Related to wso2/identity-customer-data-service#287.
@SujanSanjula96
SujanSanjula96 force-pushed the cds-improve-unify-architecture branch from 6785c52 to 62643c5 Compare November 17, 2026 23:25
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.

2 participants