Skip to content

Conversation

@cearl1
Copy link
Contributor

@cearl1 cearl1 commented Nov 19, 2025

Wider context of change

We would like to handle a journey where a user can delete their account if they do not have access to their MFA methods. From an orch perspective this involves waiting for a specific error from auth in the AuthenticationCallbackHandler, generating a new session and client session, and redirecting back to auth to start a new journey. We have split this work into 2 major parts, the first being creating a new feature flag, handling the single factor account deletion (SFAD) error from auth, and generating new sessions. The second part would be to redirect to auth to start a new journey..

What’s changed

This PR is the first part of the single factor account deletion changes. It adds a feature flag for SFAD enabled (only in dev at the moment), checks to see if there is an oauth error from auth (Note: we are using a placeholder error for the time being), and generates a new session and client session if the feature flag is enabled and the error is present.

If the user is on a reauth journey they will be redirected to the auth frontend error page, as this will not be supported in the new SFAD journey.

At the moment, the successful SFAD journey ends by redirecting to the frontend error page, and updating the new session cookies. This will be changed in a later issue.

Manual Testing

Tested an auth journey in dev which completed successfully.

Checklist

  • Lambdas have correct permissions for the resources they're accessing.
  • Impact on orch and auth mutual dependencies has been checked.
  • Changes have been made to contract tests or not required.
  • Changes have been made to the simulator or not required.
  • Changes have been made to stubs or not required.
  • Successfully deployed to authdev or not required.
  • Successfully run Authentication acceptance tests against sandpit or not required.

@cearl1 cearl1 requested review from a team as code owners November 19, 2025 12:56
@cearl1 cearl1 changed the title ATO-2107: Handle single factor account deletion error in auth callback (part 1) ATO-2107: Handle single factor account deletion journey in auth callback (part 1) Nov 19, 2025
attachLogFieldToLogs(CLIENT_ID, clientId);

// Validation
boolean reauthRequested =
Copy link
Contributor

Choose a reason for hiding this comment

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

can I ask why you added the validation comment? just because we haven't done that elsewhere and there is more validation throughout this method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, that was just a placeholder while I was figuring out the handler. I'll remove that!

auditService.submitAuditEvent(
OrchestrationAuditableEvent.AUTH_CALLBACK_RESPONSE_RECEIVED, clientId, user);
var errorCode = input.getQueryStringParameters().get("error");
if (configurationService.isSingleFactorAccountDeletionEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a log somewhere in this if to say new sessions etc have been generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good shout, the logging is a bit sparse. I've added a bunch more!

@cearl1 cearl1 force-pushed the ATO-2107/handle-oauth-error-in-auth-callback branch from 8217098 to 32a191b Compare November 20, 2025 11:19
- SFAD = Single Factor Account Deletion
- If we are on a reauth journey and get an SFAD error, we want to redirect to the auth error page.
- Error code is subject to change
@cearl1 cearl1 force-pushed the ATO-2107/handle-oauth-error-in-auth-callback branch from 32a191b to 474f394 Compare November 20, 2025 11:33
@sonarqubecloud
Copy link

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.

3 participants