Skip to content

FINERACT-2003: Enforce password reset on first login#5387

Open
DeathGun44 wants to merge 1 commit intoapache:developfrom
DeathGun44:FINERACT-2003/enforce-password-reset-on-first-login
Open

FINERACT-2003: Enforce password reset on first login#5387
DeathGun44 wants to merge 1 commit intoapache:developfrom
DeathGun44:FINERACT-2003/enforce-password-reset-on-first-login

Conversation

@DeathGun44
Copy link
Contributor

@DeathGun44 DeathGun44 commented Jan 25, 2026

Description

Implemented FINERACT-2003: Enforce password reset on first login.
This PR adds a configurable, optional policy forcing users to change their password upon first login or after an admin reset.

Key Changes

  • Database: Added password_reset_required column to m_appuser.
  • Configuration: Added force-password-reset-on-first-login global flag (disabled by default).
  • Security:
    • AuthenticationApiResource returns HTTP 403 with credentials when reset is required
    • SpringSecurityPlatformSecurityContext enforces the check for all API calls
    • PlatformUserDetailsChecker handles standard credential expiration checks
  • Logic:
    • Set flag: On user creation and admin password reset (only when feature enabled)
    • Clear flag: On successful self password change
    • Exemption: Password update requests are exempted to allow users to complete the reset
  • Testing: Added PasswordResetIntegrationTest to verify enforcement and optionality

Checklist

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

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

LGTM

@DeathGun44
Copy link
Contributor Author

@IOhacker I looked into the failed tests ,failures are in LoanDelayedScheduleCaptures and LoanMerchantIssuedRefund but these appear to be unrelated to the Authentication changes in this PR. could you please re-run them?

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch from 2d8b6b9 to cabcc33 Compare January 26, 2026 15:37
@DeathGun44
Copy link
Contributor Author

DeathGun44 commented Jan 26, 2026

@adamsaghy Happy to take reviews, if any

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

Please make sure this is optional, not enforced by default and properly tested.

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch from cabcc33 to a0eb7f7 Compare January 27, 2026 11:50
@DeathGun44
Copy link
Contributor Author

DeathGun44 commented Jan 27, 2026

Please make sure this is optional, not enforced by default and properly tested.

Understood. I will update the logic to be optional and remove the redundant Liquibase scripts. And a new integration test (PasswordResetIntegrationTest.java) to this PR to verify the enforcement and optionality as requested.

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 2 times, most recently from dbbda62 to 587c60a Compare January 27, 2026 17:59
@DeathGun44 DeathGun44 marked this pull request as draft January 27, 2026 18:41
@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 3 times, most recently from 592ce22 to a2e7e56 Compare January 28, 2026 08:03
@DeathGun44 DeathGun44 marked this pull request as ready for review January 28, 2026 08:03
@DeathGun44 DeathGun44 marked this pull request as draft January 28, 2026 12:11
@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 2 times, most recently from f51b03f to 74baa59 Compare January 29, 2026 05:44
@DeathGun44 DeathGun44 marked this pull request as ready for review January 29, 2026 07:09
@DeathGun44
Copy link
Contributor Author

@adamsaghy Ready for re-review whenever you have a moment!

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch from 74baa59 to eeb25b8 Compare January 30, 2026 17:16
@adamsaghy
Copy link
Contributor

@DeathGun44 please rebase

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 2 times, most recently from ae4306f to 97ffa3a Compare January 30, 2026 17:25
@DeathGun44
Copy link
Contributor Author

@adamsaghy Done!

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

I don’t believe this PR adequately addresses the requirements.

Any user with permission to change their password can simply override the existing one.

We need a system where the authenticated user is responsible for changing their own password!

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch from 97ffa3a to e01ec8b Compare February 3, 2026 05:06
@DeathGun44 DeathGun44 requested a review from adamsaghy February 3, 2026 05:10
@DeathGun44
Copy link
Contributor Author

@adamsaghy Hi Adam, thanks for the feedback. I've reworked the implementation to strictly enforce self-service as requested:

Dedicated Endpoint: The exemption now targets POST /users/{id}/pwd (ChangePassword) instead of the general updateUser. This limits changes to password fields only.

Identity Check: I added a check to ensure entityId == currentUser.getId(). The exemption now only applies if the user is changing their own password.

Verified Flow:

POST /users/{ownId}/pwd → Allowed (Self-check passes, account unlocked).

POST /users/{otherId}/pwd → Blocked (Self-check fails).

PUT /users/{ownId} (General update) → Blocked (Wrong endpoint).

Note: Admins can still reset passwords via the standard flow, which re-triggers the passwordResetRequired flag for the target user.

@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 2 times, most recently from a704f91 to 70fab71 Compare February 6, 2026 01:27
@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch 2 times, most recently from c77586b to b2c1471 Compare February 16, 2026 01:58
@DeathGun44 DeathGun44 force-pushed the FINERACT-2003/enforce-password-reset-on-first-login branch from b2c1471 to 4ba2f40 Compare February 16, 2026 08:05
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