You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "airajena (via GitHub)" <gi...@apache.org> on 2026/02/04 15:04:01 UTC
[PR] FINERACT-2004: Limit login retries [fineract]
airajena opened a new pull request, #5443:
URL: https://github.com/apache/fineract/pull/5443
## Description
Adds a configurable global setting to limit login retries and lock accounts after exceeding the configured threshold. Failed attempts are tracked per user, and a successful login resets the counter. This aligns with FINERACT-2004 and provides safer, configurable account protection without changing public APIs.
**Key changes**
- New global configuration `max-login-retry-attempts` (enabled flag + value).
- Track `failed_login_attempts` on `m_appuser` and lock the user when the threshold is reached.
- Reset failed attempts on successful authentication.
- Added unit tests for login attempt handling and updated integration-test defaults.
- Updated API docs with the new configuration entry.
**Testing**
- `./gradlew :fineract-core:spotlessApply :fineract-core:spotbugsMain :fineract-core:spotbugsTest :fineract-core:checkstyleMain :fineract-core:checkstyleTest`
- `./gradlew :fineract-provider:spotlessApply :fineract-provider:spotbugsMain :fineract-provider:spotbugsTest :fineract-provider:checkstyleMain :fineract-provider:checkstyleTest`
- `./gradlew :integration-tests:spotlessApply :integration-tests:spotbugsMain :integration-tests:spotbugsTest :integration-tests:checkstyleMain :integration-tests:checkstyleTest`
## Checklist
- [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
- [x] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made.
- [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
- [x] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
- [x] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-4022161856
@airajena Please rebase this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2827224591
##########
fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java:
##########
@@ -684,6 +731,10 @@ private Set<AppUserClientMapping> createAppUserClientMappings(Collection<Client>
return newAppUserClientMappings;
}
+ private static boolean isDefaultLoginRetriesExemptUser(final String username, final Boolean cannotChangePassword) {
+ return AppUserConstants.SYSTEM_USER_NAME.equalsIgnoreCase(username) || Boolean.TRUE.equals(cannotChangePassword);
Review Comment:
The system user part i got, but the `cannot change password` is why needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-4054123763
@airajena Please rebase this Pr.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2816767902
##########
fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java:
##########
@@ -86,6 +86,10 @@ public class AppUser extends AbstractPersistableCustom<Long> implements Platform
@Column(name = "nonlocked", nullable = false)
private boolean accountNonLocked;
+ @Getter
+ @Column(name = "failed_login_attempts", nullable = false)
+ private int failedLoginAttempts;
Review Comment:
Please make sure to introduce a new flag which controls whether this functionality is allowed on a particular account or not.
For example, the `system` account should NEVER be locked! Probably same applies to accounts which are used for API communication!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2827218797
##########
fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java:
##########
@@ -86,6 +86,14 @@ public class AppUser extends AbstractPersistableCustom<Long> implements Platform
@Column(name = "nonlocked", nullable = false)
private boolean accountNonLocked;
+ @Getter
+ @Column(name = "failed_login_attempts", nullable = false)
+ private int failedLoginAttempts;
+
+ @Getter
+ @Column(name = "is_login_retries_enabled", nullable = false)
+ private boolean loginRetriesEnabled;
Review Comment:
Name is misleading. This is a flag to control whether login retries are **limited** or not. Please make sure it reflects it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2848985152
##########
fineract-provider/src/main/resources/db/changelog/tenant/parts/0212_add_login_retry_configuration.xml:
##########
@@ -0,0 +1,60 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <changeSet author="fineract" id="1" context="postgresql">
+ <sql>
+ SELECT SETVAL('c_configuration_id_seq', COALESCE(MAX(id), 0)+1, false ) FROM c_configuration;
+ </sql>
+ </changeSet>
+ <changeSet author="fineract" id="2">
+ <addColumn tableName="m_appuser">
+ <column name="failed_login_attempts" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false"/>
+ </column>
+ <column name="is_login_retries_enabled" type="BOOLEAN" defaultValueBoolean="true">
Review Comment:
Updated migration to keep retry limiting disabled by default for users
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-4055006892
> @airajena Please rebase this Pr.
done, i will wait this to be merged if everything is cool, my bothers PR's also changes xml specially (https://github.com/apache/fineract/pull/5369), will have to rebase again so
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5443:
URL: https://github.com/apache/fineract/pull/5443
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2848999187
##########
fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java:
##########
@@ -684,6 +731,10 @@ private Set<AppUserClientMapping> createAppUserClientMappings(Collection<Client>
return newAppUserClientMappings;
}
+ private static boolean isDefaultLoginRetriesExemptUser(final String username, final Boolean cannotChangePassword) {
+ return AppUserConstants.SYSTEM_USER_NAME.equalsIgnoreCase(username) || Boolean.TRUE.equals(cannotChangePassword);
Review Comment:
when u pointed it out, i realised its not needed , its should not control login lock behavious, fixed it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-3867488707
Hi @adamsaghy , i checked the failed check
This failure is because Liquibase is trying to create m_command, but the table already exists in the CI database. The safest fix is to make that change set idempotent by adding a precondition like: If m_command already exists → mark the change set as ran and continue. Should I make this change or is there any other alternative?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2827200560
##########
fineract-provider/src/main/resources/db/changelog/tenant/parts/0212_add_login_retry_configuration.xml:
##########
@@ -0,0 +1,60 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <changeSet author="fineract" id="1" context="postgresql">
+ <sql>
+ SELECT SETVAL('c_configuration_id_seq', COALESCE(MAX(id), 0)+1, false ) FROM c_configuration;
+ </sql>
+ </changeSet>
+ <changeSet author="fineract" id="2">
+ <addColumn tableName="m_appuser">
+ <column name="failed_login_attempts" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false"/>
+ </column>
+ <column name="is_login_retries_enabled" type="BOOLEAN" defaultValueBoolean="true">
Review Comment:
Please dont enable it by default!
Let it be false automatically, and which ever accounts they want to enable, they can do it manually. Existing deployments might already using users for different situations where limiting is not needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-4049594265
> @airajena Please rebase this PR.
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-3921507930
@airajena Please rebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2848988343
##########
fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java:
##########
@@ -86,6 +86,14 @@ public class AppUser extends AbstractPersistableCustom<Long> implements Platform
@Column(name = "nonlocked", nullable = false)
private boolean accountNonLocked;
+ @Getter
+ @Column(name = "failed_login_attempts", nullable = false)
+ private int failedLoginAttempts;
+
+ @Getter
+ @Column(name = "is_login_retries_enabled", nullable = false)
+ private boolean loginRetriesEnabled;
Review Comment:
Internally renamed the domain flag to reflect actual semantics
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-3954249366
> Kindly see my concerns!
I made a mistake, in all my PR's all checks were passing , only there was merge conflict in the xml file, resolved , rebased and only applied check on xml, but it seems like that I have run complete ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest even for xml conflict resolve, or maybe I am missing something here. will apply all the checks and push, it was my mistake.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-3914400006
@airajena Please rebase this PR with latest `develop` branch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5443:
URL: https://github.com/apache/fineract/pull/5443#discussion_r2827200560
##########
fineract-provider/src/main/resources/db/changelog/tenant/parts/0212_add_login_retry_configuration.xml:
##########
@@ -0,0 +1,60 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <changeSet author="fineract" id="1" context="postgresql">
+ <sql>
+ SELECT SETVAL('c_configuration_id_seq', COALESCE(MAX(id), 0)+1, false ) FROM c_configuration;
+ </sql>
+ </changeSet>
+ <changeSet author="fineract" id="2">
+ <addColumn tableName="m_appuser">
+ <column name="failed_login_attempts" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false"/>
+ </column>
+ <column name="is_login_retries_enabled" type="BOOLEAN" defaultValueBoolean="true">
Review Comment:
Please dont enable it by default!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2004: Limit login retries [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5443:
URL: https://github.com/apache/fineract/pull/5443#issuecomment-3922034613
> @airajena Please rebase.
done, resolved the merge conflicts
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org