[Mifos-developer] 2 Factor Authentication Help

79 views
Skip to first unread message

Bharath Gowda

unread,
Nov 27, 2020, 1:32:13 PM11/27/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Hello Everyone,

I am working on testing and documenting 2 factor authentication usecases and need some help on configurations

I was able to successfully build the war file with 2FA enabled and I am getting a login screen to select a way to receive the authentication token.

image.png

However, the Sending Email is failing with the default email settings in the system.
"a response, re-throwing to the HTTP container
org.apache.fineract.infrastructure.core.service.PlatformEmailSendException: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25
at org.apache.fineract.infrastructure.core.service.GmailBackedPlatformEmailService.sendDefinedEmail(GmailBackedPlatformEmailService.java:81)"
image.png

Need some insight on how to configure Email in external services.
how and from where we can get the configuration details which will work


Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Michael Vorburger

unread,
Nov 28, 2020, 2:38:36 PM11/28/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
On Fri, Nov 27, 2020 at 7:31 PM Bharath Gowda <bgo...@mifos.org> wrote:
Hello Everyone,

I am working on testing and documenting 2 factor authentication usecases and need some help on configurations

I was able to successfully build the war file with 2FA enabled and I am getting a login screen to select a way to receive the authentication token.

image.png

However, the Sending Email is failing with the default email settings in the system.
"a response, re-throwing to the HTTP container
org.apache.fineract.infrastructure.core.service.PlatformEmailSendException: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25
at org.apache.fineract.infrastructure.core.service.GmailBackedPlatformEmailService.sendDefinedEmail(GmailBackedPlatformEmailService.java:81)"
image.png

Need some insight on how to configure Email in external services.
how and from where we can get the configuration details which will work
 
Bharath, I'm not sure I fully understand the exact question you are asking.. it's reading the email server configuration from that System / External Services, and you "just" need to replace the dummy default (shown in your screenshot) with a "real" (proper) SMTP email server. Does this help?

PS: Does anyone want to work on https://issues.apache.org/jira/browse/FINERACT-1270? That's such a mess...

Bharath Gowda

unread,
Nov 30, 2020, 9:27:39 AM11/30/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Hi Michael, 

It looks like it is reading the configurations from External Services, However, when we change the value of the 'port' parameter, the System is still by default referring to port 25.

"Sending the email to the following server failed: smtp.gmail.com:25"

I Changed the port to 587 but I still got the above error. so wanted to understand if this is hardcoded or reading from somewhere else which I am not able to locate.

But am sure the 'host' parameter is reading from External Services only as any change done to that, I can notice the same in the log.

If this looks like a bug let me know, I will raise a JIRA ticket for the same.





Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Bharath Gowda

unread,
Nov 30, 2020, 9:37:36 AM11/30/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
**Update**
I see an issue already reported on the same by Francis. so it is a bug :)


Would appreciate it if any developer could help in fixing this issue.


Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Michael Vorburger

unread,
Dec 3, 2020, 10:20:47 AM12/3/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Bharath,


M.
_______________________
Michael Vorburger
http://www.vorburger.ch

Bharath Gowda

unread,
Dec 3, 2020, 11:24:05 AM12/3/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Thank you Michael :)



Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Bharath Gowda

unread,
Dec 9, 2020, 10:11:34 AM12/9/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Hi Michael and others,

I was trying to again build the war file("with 2FA enabled) by pulling the latest code to get the latest fixes, but unfortunately the build is failing at 96% at a point where it does integration test. all the test cases fail with the error "404 not found"

here is the error snippet for reference, can you help me in understanding what is going wrong?
I am trying to build a war from the Fineract folder with the command "gradlew build -Ptwofactor=enabled" 



"
     The origin server did not find a current representation for the target reso
urce or is not willing to disclose that one exists.        </p>
        <hr class="line"/>
        <h3>Apache Tomcat/9.0.40</h3>
      </body>
    </html>
        at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:39)
        at org.junit.jupiter.api.Assertions.fail(Assertions.java:117)
        at org.apache.fineract.integrationtests.common.Utils.awaitSpringBootActu
atorHealthyUp(Utils.java:105)
        at org.apache.fineract.integrationtests.common.Utils.loginIntoServerAndG
etBase64EncodedAuthenticationKey(Utils.java:119)
        at org.apache.fineract.integrationtests.ClientLoanIntegrationTest.setup(
ClientLoanIntegrationTest.java:96)

ClientLoanIntegrationTest > loanWithChargesOfTypeAmountPlusInterestPercentageAnd
PeriodicAccrualAccountingEnabled() FAILED
    org.opentest4j.AssertionFailedError: /fineract-provider/actuator/health retu
rned <html lang="en">
      <head>
        <title>HTTP Status 404 û Not Found</title>
        <style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h
2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-s
ize:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {heig
ht:1px;background-color:#525D76;border:none;}</style>
      </head>
      <body>
        <h1>HTTP Status 404 û Not Found</h1>
        <hr class="line"/>
        <p>
          <b>Type</b>

     Status Report        </p>
        <p>
          <b>Description</b>

     The origin server did not find a current representation for the target reso
urce or is not willing to disclose that one exists.        </p>
        <hr class="line"/>
        <h3>Apache Tomcat/9.0.40</h3>
      </body>
    </html>
        at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:39)
        at org.junit.jupiter.api.Assertions.fail(Assertions.java:117)
        at org.apache.fineract.integrationtests.common.Utils.awaitSpringBootActu
atorHealthyUp(Utils.java:105)
        at org.apache.fineract.integrationtests.common.Utils.loginIntoServerAndG
etBase64EncodedAuthenticationKey(Utils.java:119)  "

Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Michael Vorburger

unread,
Dec 11, 2020, 4:51:02 PM12/11/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Petri, thanks! WOuld you like to capture this in a new JIRA, for future reference?

Bharat, I just want to make extra sure that there is no misunderstanding about what you are trying to achieve here: Are you a) trying to get /actuator/health to work with "gradlew build -Ptwofactor=enabled", OR b) do you really just want to locally build the very latest Fineract WAR from the develop branch in git? Because it's the latter, then you can just skip running the tests locally, so like by using "gradlew war -Ptwofactor=enabled" instead of "build". (You can even make it a little faster by using "gradlew -x spotlessJava -x spotlessJavaCheck -x compileTestJava war".)

But before you ;) retry, note https://issues.apache.org/jira/browse/FINERACT-1280 where Francis pointed out that FINERACT-1070 was not correctly fixed; watch that issue for updates.

On Wed, Dec 9, 2020 at 11:58 PM Petri Tuomola <pe...@tuomola.org> wrote:
Hi Bharath

I looked at this in September / October, and back then my findings were as below:

-----

If you look at securityContext, you can see that TenantAwareTenantIdentifierFilter is only applied in the “oauth” profile. It doesn’t get used in the basicauth scenario.

I think there are actually two different issues here:

1. TenantAwareTenantIdentifierFilter rejects the request to /actuator/health because it has no tenant identifier in it. But even if we work around this by adding a check for the specific path /fineract-provider/actuator/health and bypassing the check, we hit the next issue

2. In oauth profile, Spring does not register DispatcherServlet as it thinks it has already been registered. So even if the filter is bypassed, you end up with 404 because there is no DispatcherServlet to route the call to the Spring Actuator.

I think the 2nd problem is because one of the filters used for oauth gets registered as a servlet filter - this seems to be default behaviour of Spring. See here for example:

"One last thing: In case you are using a custom authentication filter (e.g. for token based authentication) you might have to take care that you don't register your filter as a Servlet Filter as well. You can influence that by configuring a method returning a FilterRegistrationBean and accepting an instance of your Filter. just create a new FilterRegistrationBean for your filter and set enabled to false.” from http://blog.florian-hopf.de/2017/08/spring-security.html

But oauth / Spring Security is not my area of expertise, so would be great if someone with more knowledge could comment (and ideally, provide a fix)…

Regards
Petri


<image.png>

However, the Sending Email is failing with the default email settings in the system.
"a response, re-throwing to the HTTP container
org.apache.fineract.infrastructure.core.service.PlatformEmailSendException: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25
at org.apache.fineract.infrastructure.core.service.GmailBackedPlatformEmailService.sendDefinedEmail(GmailBackedPlatformEmailService.java:81)"
<image.png>

Need some insight on how to configure Email in external services.
how and from where we can get the configuration details which will work

Bharath Gowda

unread,
Dec 14, 2020, 8:02:22 AM12/14/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Thank you, Petri and Michael, for your help

@Michael

I just want to build the later Fineract war to test and implement 2FA for one of our projects.
I will surely try out those commands once the email issues are resolved.
and thank you for honest and right answers always, which is really helpful and making us learn and know more every time :)






Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Emmanuel Njoku

unread,
Dec 14, 2020, 2:19:12 PM12/14/20
to Mifos software development, Dev, A good place to start for users or folks new to Mifos.
Dear All,

please I need an assist on the following for MIFOS

Unable to delete fineract-provider folder the error is Destination Path Too Long.

The second error message is after cloning https://github.com/openMF/incubator-fineract.git and build successfully and deployed on the apache tomcat 7.0.103. I am unable to open 

HTTP Status 404 – Not Found


Type Status Report

Message /fineract-provider/api-docs/apiLive.htm

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Mifos-developer mailing list
mifos-d...@lists.sourceforge.net
Unsubscribe or change settings at:
https://lists.sourceforge.net/lists/listinfo/mifos-developer

Emmanuel Njoku

unread,
Dec 14, 2020, 2:28:19 PM12/14/20
to Michael Vorburger, Mifos software development, Dev, A good place to start for users or folks new to Mifos., Bharath Gowda

Awasum Yannick

unread,
Dec 16, 2020, 3:37:54 AM12/16/20
to Mifos software development, Dev, A good place to start for users or folks new to Mifos.
Hi Emmanuel,

On Mon, Dec 14, 2020 at 8:28 PM Emmanuel Njoku <ein...@gmail.com> wrote:
Dear All,

please I need an assist on the following for MIFOS

Unable to delete fineract-provider folder the error is Destination Path Too Long.

I dont understand where you are deploying or what you are trying to do.

The second error message is after cloning https://github.com/openMF/incubator-fineract.git and build successfully and deployed on the apache tomcat 7.0.103. I am unable to open 

https://github.com/openMF/incubator-fineract is no longer active and is in archive mode. Please use https://github.com/apache/fineract as the basis of your backend. Maybe from there you can integrate Pentaho on your end. Its also a good idea to branch from the 1.4.0 tag on github. There is an already build and released Fineract 1.4.0 on the website: http://fineract.apache.org/

If you are waiting for the Latest Mifos Release with Pentaho built on top of the latest Fineract release then you will have to ask the folks at Mifos for a timeline or if they plan on making a release.

Let us know how we can help you.

Thanks.
Awasum

Michael Vorburger

unread,
Dec 16, 2020, 2:04:14 PM12/16/20
to Awasum Yannick, Dev, Mifos software development, A good place to start for users or folks new to Mifos.
On Wed, Dec 16, 2020 at 9:17 AM Awasum Yannick <awa...@apache.org> wrote:
Hi Emmanuel,

On Mon, Dec 14, 2020 at 8:28 PM Emmanuel Njoku <ein...@gmail.com> wrote:
Dear All,

please I need an assist on the following for MIFOS

Unable to delete fineract-provider folder the error is Destination Path Too Long.

I dont understand where you are deploying or what you are trying to do.

The second error message is after cloning https://github.com/openMF/incubator-fineract.git and build successfully and deployed on the apache tomcat 7.0.103. I am unable to open 

https://github.com/openMF/incubator-fineract is no longer active and is in archive mode. Please use https://github.com/apache/fineract as the basis of your backend. Maybe from there you can integrate Pentaho on your end. Its also a good idea to branch from the 1.4.0 tag on github. There is an already build and released Fineract 1.4.0 on the website: http://fineract.apache.org/

If you are waiting for the Latest Mifos Release with Pentaho built on top of the latest Fineract release then you will have to ask the folks at Mifos for a timeline or if they plan on making a release.

Re. Pentaho, please also note https://github.com/vorburger/fineract-pentaho. (FYI it's currently a little cumbersome to install on Windows; watch https://github.com/vorburger/fineract-pentaho/issues/2 for an improvement for that I'll work on when I have some time.)

Emmanuel Njoku

unread,
Dec 16, 2020, 2:36:27 PM12/16/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Dear team,

Unable to select a list of created charges

Unable to create a product because of charge id
{
  "name": "Tax Holding Savings",
  "shortName": "TXSV",
  "description": "Tax Holding Account",
  "currencyCode": "USD",
  "digitsAfterDecimal": 2,
  "inMultiplesOf": 0,
  "locale": "en",
  "nominalAnnualInterestRate": "0.0",
  "interestCompoundingPeriodType": 1,
  "interestPostingPeriodType":4,
  "interestCalculationType": 1,
  "interestCalculationDaysInYearType": "365",
  "accountingRule":"1",
  "charges":[{"id":"1"}]
}

Emmanuel Njoku

unread,
Dec 17, 2020, 4:54:53 AM12/17/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
Dear team,

Francis Guchie

unread,
Dec 17, 2020, 4:59:04 AM12/17/20
to Mifos software development, Dev, A good place to start for users or folks new to Mifos.
Dear Emanuel,

I dont clearly understand what you are trying to achieve here but if you can contact me directly (16 & 17 dec am not available) i guess i will provide you with a faster solution.


My Kind Regards

Francis Guchie Kirago
Skype: francisguchie
Telegram: 232 79 19 44 07
Whatsapp: 232 79 19 44 07
twitter: @FrancisGuchie








Emmanuel Njoku

unread,
Dec 17, 2020, 7:05:17 AM12/17/20
to Dev, Mifos software development, A good place to start for users or folks new to Mifos.
On the web service, I can't fetch a list of charges and I can't open a savings product. 
To open account with this payload
{
  "name": "Tax Savings",

  "shortName": "TXSV",
  "description": "Tax Holding Account",
  "currencyCode": "NGN",

  "digitsAfterDecimal": 2,
  "inMultiplesOf": 0,
  "locale": "en",
  "nominalAnnualInterestRate": "0.0",
  "interestCompoundingPeriodType": 1,
  "interestPostingPeriodType":4,
  "interestCalculationType": 1,
  "interestCalculationDaysInYearType": "365",
  "accountingRule":"1",
  "charges":[{"id":"1"}]
}

Bharath Gowda

unread,
Dec 17, 2020, 11:54:59 AM12/17/20
to Emmanuel Njoku, Mifos software development, Dev, A good place to start for users or folks new to Mifos.
Hi Emmanuel,

Could you please let us know the release version you are using? 
It would have been helpful if you could have shared more configuration details of your instance to assist you accurately.

From a high level, it looks like a configuration issue and a little peek into your instance will help us in resolving the issue.

I am available tomorrow to assist you, my time zone is IST, and will be available between 5:00 PM to 11:00 PM IST.
Please feel free to ping me on skype(handle ID:live:cbharath4) at any time between that slot.

Also, a sincere request to write your issues with more details and initiate a separate thread always, it would be easier for the community team to understand and help you effectively.


Regards,
Bharath
Lead Implementation Analyst | Mifos Initiative
Skype: live:cbharath4| Mobile: +91.7019635592

Emmanuel Njoku

unread,
Dec 17, 2020, 12:21:59 PM12/17/20
to Bharath Gowda, Mifos software development, Dev, A good place to start for users or folks new to Mifos.
Dear team,

This is the GIT I cloned https://github.com/apache/fineract.git that is (https://github.com/apache/fineract) after building the war file and deployed i found the issue.

Regards
Reply all
Reply to author
Forward
0 new messages