Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

AccountManagementService bug or not?

Avatar

Level 4

[Re-post from: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-forms/accountmanagementser...]

 

I was looking at the "AccountManagementService" as this function provide two nice features to validate users who can register themselves and it provide a feature to allow user to reset their own password.

 

One point I want to understand is the host validation. The host name of the production server is not the same as the URL the external customer is looking at. So for the generation of the email we call the service accountManagementService.requestPasswordReset with the hostname equal to the external facing hostname. This hostname is embedded in the token as one of the secured parameters AND is used to generate the URL in the email that the user can click.

 

On the return the system validate the token in the "AccountManagementServlet"  with this private code below. The host name here is the internal host name so the token will always be invalid as the internal host name is different from the external host name embedded in the token. Is there something I overlook here?

 

  private boolean isTokenValid(String token, String hostname) {
if (!this.jwsValidator.validate(token))
return false;
String hostField = getTokenField(token, "host");
return (hostField != null && !"".equals(hostField) && hostname != null &&
!"".equals(hostname) && hostField.equals(hostname));
}

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Correct answer by
Community Advisor

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now