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 
<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


> On 9 Dec 2020, at 11:10 PM, Bharath Gowda <[email protected]> wrote:
> 
> 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
> http://mifos.org <http://mifos.org/>  <http://facebook.com/mifos>  
> <http://www.twitter.com/mifos>
> 
> 
> On Thu, Dec 3, 2020 at 9:53 PM Bharath Gowda <[email protected] 
> <mailto:[email protected]>> wrote:
> Thank you Michael :)
> 
> 
> 
> Regards,
> Bharath
> Lead Implementation Analyst | Mifos Initiative
> Skype: live:cbharath4| Mobile: +91.7019635592
> http://mifos.org <http://mifos.org/>  <http://facebook.com/mifos>  
> <http://www.twitter.com/mifos>
> 
> 
> On Thu, Dec 3, 2020 at 8:50 PM Michael Vorburger <[email protected] 
> <mailto:[email protected]>> wrote:
> Bharath,
> 
> I have fixed https://issues.apache.org/jira/browse/FINERACT-1070 
> <https://issues.apache.org/jira/browse/FINERACT-1070> for you. - Enjoy!
> 
> M.
> _______________________
> Michael Vorburger
> http://www.vorburger.ch <http://www.vorburger.ch/>
> 
> 
> On Mon, Nov 30, 2020 at 3:30 PM Bharath Gowda <[email protected] 
> <mailto:[email protected]>> wrote:
> **Update**
> I see an issue already reported on the same by Francis. so it is a bug :)
> 
> https://issues.apache.org/jira/browse/FINERACT-1070 
> <https://issues.apache.org/jira/browse/FINERACT-1070>
> 
> 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
> http://mifos.org <http://mifos.org/>  <http://facebook.com/mifos>  
> <http://www.twitter.com/mifos>
> 
> 
> On Mon, Nov 30, 2020 at 7:51 PM Bharath Gowda <[email protected] 
> <mailto:[email protected]>> wrote:
> 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 
> <http://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
> http://mifos.org <http://mifos.org/>  <http://facebook.com/mifos>  
> <http://www.twitter.com/mifos>
> 
> 
> On Sun, Nov 29, 2020 at 1:08 AM Michael Vorburger <[email protected] 
> <mailto:[email protected]>> wrote:
> On Fri, Nov 27, 2020 at 7:31 PM Bharath Gowda <[email protected] 
> <mailto:[email protected]>> 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 <http://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 
> <https://issues.apache.org/jira/browse/FINERACT-1270>? That's such a mess...
> 
> Regards,
> Bharath
> Lead Implementation Analyst | Mifos Initiative
> Skype: live:cbharath4| Mobile: +91.7019635592
> http://mifos.org <http://mifos.org/>  <http://facebook.com/mifos>  
> <http://www.twitter.com/mifos>

Reply via email to