Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check claim uniqueness without duplicate claim check #6492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sahandilshan
Copy link
Contributor

Purpose

  • Do the Password can't be equal to login attributes policy check correctly by only validating if the password is equal to a unique claim. It won't check if the unique claim is duplicated with other user
  • As a fix to Password policy edge case issue: Password can't be equal to claim values (email) on Password recovery flow product-is#12699, we have sent the following Enable 'Password can't be equal to login attributes' for password recovery flow #3812, where it calls the checkClaimUniqueness method to check if the password is equal to a login attribute. The problem here is that the checkClaimUniqueness is doing additional validation where it checks if the login attributes have been duplicated in the same userstore. So if two users share the same login attribute values (ex: same emails), when the password is getting updated, it will first check
    1. If the password is equal to a login attribute (if the user hasn't used a login attribute as the password this logic will be passed)
    2. Then it checks if the login attribute is duplicated in the same userstore (For a password reset scenario, this is not needed). password reset gets an error due to this logic.

In this PR, we have introduced a new method that only does the first check and ignores the second check for admin-initiated password reset scenarios

Related Issue(s)

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/13323378339

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.

Project coverage is 47.19%. Comparing base (483b719) to head (7248981).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
...istener/UniqueClaimUserOperationEventListener.java 0.00% 32 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6492      +/-   ##
============================================
+ Coverage     46.86%   47.19%   +0.33%     
- Complexity    15252    15292      +40     
============================================
  Files          1747     1747              
  Lines        105558   105400     -158     
  Branches      19565    19511      -54     
============================================
+ Hits          49467    49742     +275     
+ Misses        49076    48602     -474     
- Partials       7015     7056      +41     
Flag Coverage Δ
unit 30.48% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/13323378339
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

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

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/13323378339

@piraveena
Copy link
Contributor

Please add unit tests

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