Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-owls-match.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/identity-apps-core": patch
---

Pass the anonymous profile tracker in self registration and on each request that continues a registration flow
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@
return Object.keys(inputs).length > 0 ? { inputs } : {};
};
const withAnonymousProfileTracker = (body) => {
if (!body || !body.flowId || anonymousProfileTracker === "null") {
return body;
}
return {
...body,
inputs: { ...(body.inputs || {}), anonymous_profile_tracker: anonymousProfileTracker }
};
};
const [ flowData, setFlowData ] = useState(null);
const [ components, setComponents ] = useState([]);
const [ loading, setLoading ] = useState(true);
Expand Down Expand Up @@ -286,7 +297,7 @@
fetch(executionFlowApiProxyPath, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(postBody)
body: JSON.stringify(withAnonymousProfileTracker(postBody))
})
.then((response) => {
if (!response.ok) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,16 @@
}
// After existing claim population loop
String cdsProfileCookie = request.getParameter("http://wso2.org/claims/cdsProfile");
String cdsProfileCookie = null;
Cookie[] requestCookies = request.getCookies();
if (requestCookies != null) {
for (Cookie requestCookie : requestCookies) {
if ("cds_profile".equals(requestCookie.getName())) {
cdsProfileCookie = requestCookie.getValue();
break;
}
}
}
if (StringUtils.isNotBlank(cdsProfileCookie)) {
Claim profileIdClaim = new Claim();
profileIdClaim.setUri("http://wso2.org/claims/cdsProfile");
Expand Down Expand Up @@ -411,6 +420,13 @@
properties.add(spIdProperty);
properties.add(appIsAccessUrlAvailableProperty);
if (StringUtils.isNotBlank(cdsProfileCookie)) {
Property anonymousProfileTrackerProperty = new Property();
anonymousProfileTrackerProperty.setKey("anonymous_profile_tracker");
anonymousProfileTrackerProperty.setValue(cdsProfileCookie);
properties.add(anonymousProfileTrackerProperty);
}
SelfUserRegistrationRequest selfUserRegistrationRequest = new SelfUserRegistrationRequest();
selfUserRegistrationRequest.setUser(selfRegistrationUser);
selfUserRegistrationRequest.setProperties(properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,6 @@
%>

<% request.setAttribute("pageName", "self-registration-username-request"); %>
<%
String cdsProfileCookie = null;
if (cookies != null) {
for (javax.servlet.http.Cookie cookie : cookies) {
if ("cds_profile".equals(cookie.getName())) {
cdsProfileCookie = cookie.getValue();
break;
}
}
}
if (cdsProfileCookie != null) {
// Set as a request attribute to be used in your form
request.setAttribute("cds_profile", cdsProfileCookie);
}
%>

<!doctype html>
<html lang="en-US">
Expand Down Expand Up @@ -912,7 +896,6 @@
value="<%=value%>" class="form-control">
</div>
<% } %>
<input type="hidden" name="http://wso2.org/claims/cdsProfile" value="<%= cdsProfileCookie != null ? cdsProfileCookie : "" %>">

<div id="password-validation-block">
<div id="length-block" class="password-policy-description mb-2" style="display: none;">
Expand Down