-
Notifications
You must be signed in to change notification settings - Fork 560
Add validation for admin password reset config updates. #6664
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
Add validation for admin password reset config updates. #6664
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6664 +/- ##
============================================
+ Coverage 48.20% 48.36% +0.15%
- Complexity 16407 16497 +90
============================================
Files 1830 1833 +3
Lines 109630 111940 +2310
Branches 20646 21040 +394
============================================
+ Hits 52849 54139 +1290
- Misses 49552 50482 +930
- Partials 7229 7319 +90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
There was a problem hiding this 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/14266111360
...gt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementUtil.java
Outdated
Show resolved
Hide resolved
components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds validations for admin password reset configuration updates to ensure that only one of the possible options (Email Link, Email OTP, Offline, SMS OTP) is enabled at a time, and provides automatic correction when all are disabled. Key changes include the introduction of new validation methods in IdPManagementUtil, updates to test cases in IdPManagementUtilTest, and corresponding constant and DAO modifications to support the new logic.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/util/IdPManagementUtilTest.java | Added tests and helper methods for validating admin password reset configurations; contains a variable naming typo. |
components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementUtil.java | Introduced new validation methods for admin password reset options. |
components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java | Added new constants for the admin password reset configurations. |
components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java | Updated DAO logic to read the new admin reset configurations and to auto-correct them if necessary. |
Files not reviewed (1)
- components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql: Language not supported
Comments suppressed due to low confidence (1)
components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java:6241
- [nitpick] For consistency with other parts of the code, consider using the predefined TRUE_STRING constant instead of String.valueOf(true) when setting the property value.
adminForcedPasswordResetProperty.setValue(String.valueOf(true));
...rg.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/util/IdPManagementUtilTest.java
Outdated
Show resolved
Hide resolved
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
|
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
Integration test runner only fails due to ![]() |
Purpose
Related issues
Approach
Recovery.AdminPasswordReset.RecoveryLink
Recovery.AdminPasswordReset.OTP
Recovery.AdminPasswordReset.Offline
Recovery.AdminPasswordReset.SMSOTP
After merge
[1] https://github.com/wso2-extensions/identity-governance/blob/381c5fffa0d694db0fdecdb1ec17aab40a1adb42/components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityGovernanceServiceImpl.java#L76