Skip to content

Commit 6f0edd9

Browse files
author
Madhukar
committed
Merge branch fineract-1.1.0 into incubator-fineract 'develop'
2 parents bf37d33 + d2b3411 commit 6f0edd9

File tree

531 files changed

+41858
-929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

531 files changed

+41858
-929
lines changed

LICENSE_RELEASE

+4
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,8 @@ This product bundles Backport Util Concurrent v3.1 written by Dawid Kurzyniec,
300300
which is avilable under Public Domain license.
301301
For details see licenses/binary/Backport.PL
302302

303+
This product bundles JarAnalyzer v1.2 written by Kirk Knoernschild,
304+
which is available under BSD license.
305+
For details see licences/binary/JarAnalyzer.BSD
306+
303307
******************************************

api-docs/apiLive.htm

+242
Original file line numberDiff line numberDiff line change
@@ -2629,6 +2629,30 @@ <h2 class="flybar-button">User</h2>
26292629
<td></td>
26302630
</tr>
26312631
<tr>
2632+
<td><a href="#twofactor">Two-Factor Authentication</a></td>
2633+
<td>twofactor</td>
2634+
<td><a href="#twofactor_request">Request OTP</a></td>
2635+
<td><a href="#twofactor_deliverymethods">List OTP delivery methods</a></td>
2636+
<td></td>
2637+
<td></td>
2638+
</tr>
2639+
<tr>
2640+
<td></td>
2641+
<td>twofactor/validate</td>
2642+
<td><a href="#twofactor_validate">Validate OTP</a></td>
2643+
<td></td>
2644+
<td></td>
2645+
<td></td>
2646+
</tr>
2647+
<tr>
2648+
<td></td>
2649+
<td>twofactor/invalidate</td>
2650+
<td><a href="#twofactor_invalidate">Invalidate Access Token</a></td>
2651+
<td></td>
2652+
<td></td>
2653+
<td></td>
2654+
</tr>
2655+
<tr>
26322656
<td><a href="#users">User</a></td>
26332657
<td>users</td>
26342658
<td><a href="#users_create">Create a User</a></td>
@@ -2942,6 +2966,16 @@ <h2 class="flybar-button">System</h2>
29422966
external service Configuration</a></td>
29432967
<td></td>
29442968
</tr>
2969+
<tr>
2970+
<td><a href="#twofactor_config_get">Two-Factor Configuration</a></td>
2971+
<td>twofactor/configure</td>
2972+
<td></td>
2973+
<td><a href="#twofactor_config_get">Retrieve
2974+
Two-Factor Configuration</a></td>
2975+
<td><a href="#twofactor_config_update">Update
2976+
Two-Factor Configuration</a></td>
2977+
<td></td>
2978+
</tr>
29452979
</table>
29462980
</div>
29472981
</div>
@@ -3930,6 +3964,11 @@ <h3>Authentication Overview</h3>
39303964
Default authentication is using HTTP Basic Auth. Oauth2 can be enabled by using <i>-Psecurity=oauth</i> option on gradle build command , refer
39313965
the platform setup <a href="https://github.com/openMF/mifosx/wiki/Launching-platform-server-locally-from-the-command-line#choosing-authentication-mechanism"> wiki</a> for additional details.
39323966
</p>
3967+
<p>
3968+
Optionally, two-factor authentication can be enabled by using
3969+
<i>-Ptwofactor=enabled</i> on gradle build.
3970+
Details of the authentication workflow with two-factor authentication enabled can be found <a href="#twofactor">here</a>.
3971+
</p>
39333972
<p>
39343973
The platform has been configured to reject plain HTTP requests and
39353974
to expect all API requests to be made over <a
@@ -4057,6 +4096,142 @@ <h3>Authentication Oauth2</h3>
40574096
</code>
40584097
</div>
40594098
</div>
4099+
<a id="twofactor" name="twofactor" class="old-syle-anchor">&nbsp;</a>
4100+
<div class="method-section">
4101+
<div class="method-description">
4102+
<h3>Two-Factor Authentication</h3>
4103+
<p>
4104+
Two-Factor authentication is supported by requesting & verifying
4105+
one-time passwords(OTP). OTPs are sent via SMS & email.
4106+
</p>
4107+
<p>
4108+
By default, two-factor authentication is disabled by default.
4109+
More information on how to enable TFA can be found <a href="#authentication_overview">here</a>.
4110+
</p>
4111+
<p>
4112+
Two-factor authentication workflow:
4113+
<ol class="normalli">
4114+
<li class="normalli">User authticates via BasicAuth / oAauth</li>
4115+
<li>Client requests a list of supported OTP delivery methods for the authenticated user(<a href="#twofactor_deliverymethods">Get Delivery Methods</a>)</li>
4116+
<li>User selects an OTP delivery method and client sends a request for OTP(<a href="#twofactor_request">Request OTP</a>)</li>
4117+
<li>User receives an OTP and the client sends it for verification(<a href="#twofactor_validate">Validate OTP</a>)</li>
4118+
<li>If the OTP is valid, an access token is returned</li>
4119+
<li>The access token is sent in following requestes to the server as a header <i>Fineract-Platform-TFA-Token</i></li>
4120+
<li>On session end, the access token should be invalidated<a href="#twofactor_invalidate">Invalidate Access Token</a>)</li>
4121+
</ol>
4122+
</p>
4123+
<p>
4124+
Two-Factor authentication and delivery methods can be configured via
4125+
the <a href="#twofactor_configure"<i>/twofactor/configure</i> endpoint.</a>
4126+
</p>
4127+
</div>
4128+
<div class="method-example">
4129+
4130+
</div>
4131+
</div>
4132+
4133+
<a id="twofactor_deliverymethods" name="twofactor_deliverymethods" class="old-syle-anchor">&nbsp;</a>
4134+
<div class="method-section">
4135+
<div class="method-description">
4136+
<h4>Get Delivery Methods</h4>
4137+
<p>Returns a list of possible OTP delivery methods for the current user</p>
4138+
<p>Requires first-factor authenticated user.</p>
4139+
</div>
4140+
<div class="method-example">
4141+
<code class="method-declaration">GET https://DomainName/api/v1/twofactor</code>
4142+
<code class="method-response">
4143+
[
4144+
{
4145+
"name": "sms",
4146+
"target": "08888888888"
4147+
},
4148+
{
4149+
"name": "email",
4150+
"target": "user@example.com"
4151+
}
4152+
]</code>
4153+
</div>
4154+
</div>
4155+
4156+
<a id="twofactor_request" name="twofactor_request" class="old-syle-anchor">&nbsp;</a>
4157+
<div class="method-section">
4158+
<div class="method-description">
4159+
<h4>Request OTP</h4>
4160+
<p>Requests an OTP.</p>
4161+
<p>Requires first-factor authenticated user.</p>
4162+
<h5>Arguments</h5>
4163+
<dl class="argument-list">
4164+
<dt>deliveryMethod</dt>
4165+
<dd>
4166+
String<span> mandatory, the delivery method name</span>
4167+
</dd>
4168+
<dt>extendedToken</dt>
4169+
<dd>
4170+
boolean<span> optional, whether to request an extended token, default false</span>
4171+
</dd>
4172+
</dl>
4173+
</div>
4174+
<div class="method-example">
4175+
<code class="method-declaration">POST https://DomainName/api/v1/twofactor?deliveryMethod=sms&extendedToken=false</code>
4176+
<code class="method-response">
4177+
{
4178+
"requestTime": 1500000000000,
4179+
"tokenLiveTimeInSec": 300,
4180+
"extendedAccessToken": false,
4181+
"deliveryMethod": {
4182+
"name": "sms",
4183+
"target": "08888888888"
4184+
}
4185+
}</code>
4186+
</div>
4187+
</div>
4188+
4189+
<a id="twofactor_validate" name="twofactor_validate" class="old-syle-anchor">&nbsp;</a>
4190+
<div class="method-section">
4191+
<div class="method-description">
4192+
<h4>Validate OTP</h4>
4193+
<p>Validates an OTP. If the OTP is valid, an access token is created.</p>
4194+
<p>The returned access token is later sent as a header <i>Fineract-Platform-TFA-Token</i>.</p>
4195+
<p>Requires first-factor authenticated user.</p>
4196+
<h5>Arguments</h5>
4197+
<dl class="argument-list">
4198+
<dt>token</dt>
4199+
<dd>
4200+
String<span> mandatory, the OTP to validate</span>
4201+
</dd>
4202+
</dl>
4203+
</div>
4204+
<div class="method-example">
4205+
<code class="method-declaration">POST https://DomainName/api/v1/twofactor/validate?token=YYYYY</code>
4206+
<code class="method-response">
4207+
{
4208+
"token": "cb0bb6e33fc540709d50a16eb2e555f9",
4209+
"validFrom": 1501530702801,
4210+
"validTo": 1501617102801
4211+
}</code>
4212+
</div>
4213+
</div>
4214+
4215+
<a id="twofactor_invalidate" name="twofactor_invalidate" class="old-syle-anchor">&nbsp;</a>
4216+
<div class="method-section">
4217+
<div class="method-description">
4218+
<h4>Invalidate Access Token</h4>
4219+
<p>Invalidates an access token.</p>
4220+
<p>Two factor access tokens should be invalidated on logout.</p>
4221+
<p>Requires fully authenticated user.</p>
4222+
</div>
4223+
<div class="method-example">
4224+
<code class="method-declaration">POST https://DomainName/api/v1/twofactor/invalidate</code>
4225+
<code class="method-request">
4226+
{
4227+
"token": "cb0bb6e33fc540709d50a16eb2e555f9"
4228+
}</code>
4229+
<code class="method-response">
4230+
{
4231+
"resourceIdentifier": "cb0bb6e33fc540709d50a16eb2e555f9"
4232+
}</code>
4233+
</div>
4234+
</div>
40604235

40614236
<a id="batch_api" name="batch_api" class="old-syle-anchor">&nbsp;</a>
40624237
<div class="method-section">
@@ -19391,6 +19566,73 @@ <h4>Update External Service</h4>
1939119566
</div>
1939219567
</div>
1939319568

19569+
<a id="twofactor_config" name="twofactor_config"
19570+
class="old-syle-anchor">&nbsp;</a>
19571+
<div class="method-section">
19572+
<div class="method-description">
19573+
<h3>Two-Factor Configuration</h3>
19574+
<p>The following section describes the way to configure two-factor authentication</p>
19575+
<p>Two-Factor Authentication has to be enabled by either building with Gradle arguments
19576+
<i>-Ptwofactor=enabled</i> or enabling the <i>twofactor</i> profile via env. variable
19577+
</p>
19578+
<p>In order for SMS to be enabled an SMS bridge has to be setup with the message-gateway service.</p>
19579+
</div>
19580+
<div class="method-example">
19581+
</div>
19582+
</div>
19583+
19584+
<a id="twofactor_config_get" name="twofactor_config_get" class="old-syle-anchor">&nbsp;</a>
19585+
<div class="method-section">
19586+
<div class="method-description">
19587+
<h4>Retrieve Two-Factor Configuration</h4>
19588+
<p>Returns available two-factor configuration.</p>
19589+
</div>
19590+
<div class="method-example">
19591+
<code class="method-declaration"> GET https://DomainName/api/v1/twofactor/configure
19592+
</code>
19593+
<code class="method-response">
19594+
{
19595+
"otp-delivery-email-body": "Hello {{username}}.\n\nYour OTP login token is {{token}}.",
19596+
"otp-delivery-sms-enable": true,
19597+
"otp-delivery-sms-provider": 6,
19598+
"otp-delivery-email-subject": "Fineract Two-Factor Authentication Token",
19599+
"otp-token-length": 5,
19600+
"access-token-live-time-extended": 604800,
19601+
"otp-delivery-email-enable": true,
19602+
"otp-token-live-time": 300,
19603+
"otp-delivery-sms-text": "Your authentication token for Fineract is {{token}}.",
19604+
"access-token-live-time": 86400
19605+
}
19606+
</code>
19607+
</div>
19608+
</div>
19609+
19610+
<a id="twofactor_config_update" name="twofactor_config_update" class="old-syle-anchor">&nbsp;</a>
19611+
<div class="method-section">
19612+
<div class="method-description">
19613+
<h4>Update Two-Factor Configuration</h4>
19614+
<p>Update two-factor configuration.</p>
19615+
</div>
19616+
<div class="method-example">
19617+
<code class="method-declaration"> PUT https://DomainName/api/v1/twofactor/configure
19618+
</code>
19619+
<code class="method-request">
19620+
{
19621+
"otp-delivery-sms-provider": 7
19622+
"otp-delivery-sms-enable": false
19623+
}
19624+
</code>
19625+
<code class="method-response">
19626+
{
19627+
"changes": {
19628+
"otp-delivery-sms-enable": false,
19629+
"otp-delivery-sms-provider": 7
19630+
}
19631+
}
19632+
</code>
19633+
</div>
19634+
</div>
19635+
1939419636
<!-- Fund starts here -->
1939519637
<a id="funds" name="funds" class="old-syle-anchor">&nbsp;</a>
1939619638
<div class="method-section">

api-docs/apidocs.css

+4
Original file line numberDiff line numberDiff line change
@@ -745,4 +745,8 @@ ul.field li {
745745

746746
tt {
747747
font-size: 9.5pt;
748+
}
749+
750+
ol.normalli li {
751+
list-style-type: decimal;
748752
}

fineract-provider/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ repos
77
.settings
88
.gradle
99
*.log
10+
.idea
1011
!gradle/wrapper/gradle-wrapper.jar
1112
/gradle

fineract-provider/build.gradle

+26-10
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,33 @@ if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
197197

198198
/* Enable Oauth2 authentication based on environment, default to HTTP basic auth */
199199
if (project.hasProperty('security') && project.getProperty('security') == 'oauth') {
200-
copy {
201-
from './properties/oauth/'
202-
into 'src/main/resources/'
203-
include '*.properties'
204-
}
200+
if(project.hasProperty('twofactor') && project.getProperty('twofactor') == 'enabled') {
201+
copy {
202+
from './properties/oauth/twofactor/'
203+
into 'src/main/resources/'
204+
include '*.properties'
205+
}
206+
} else {
207+
copy {
208+
from './properties/oauth/'
209+
into 'src/main/resources/'
210+
include '*.properties'
211+
}
212+
}
205213
} else {
206-
copy {
207-
from './properties/basicauth/'
208-
into 'src/main/resources/'
209-
include '*.properties'
210-
}
214+
if(project.hasProperty('twofactor') && project.getProperty('twofactor') == 'enabled') {
215+
copy {
216+
from './properties/basicauth/twofactor/'
217+
into 'src/main/resources/'
218+
include '*.properties'
219+
}
220+
} else {
221+
copy {
222+
from './properties/basicauth/'
223+
into 'src/main/resources/'
224+
include '*.properties'
225+
}
226+
}
211227
}
212228

213229
task dist(type:Zip){

fineract-provider/dependencies.gradle

+7-2
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,22 @@ dependencies {
101101
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
102102
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
103103
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
104-
104+
[group: 'org.apache.tika', name: 'tika-core', version :'1.9'],
105105
// Although fineract (at the time of writing) doesn't have any compile time dep. on this,
106106
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
107107
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
108108
// Once we've switched to Java 8 this dep can be removed.
109109
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
110+
[group: 'org.springframework', name:'spring-jms'],
111+
[group: 'org.apache.activemq', name: 'activemq-broker']
112+
110113
)
111114
testCompile 'junit:junit:4.11',
112115
'junit:junit-dep:4.11',
113116
'org.mockito:mockito-core:1.9.5',
114117
'com.jayway.restassured:rest-assured:2.3.3',
115-
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion]
118+
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion],
119+
[group: 'com.mockrunner', name: 'mockrunner-jms', version: '1.0.6'],
120+
[group: 'com.mockrunner', name: 'mockrunner-jdbc', version: '1.0.6']
116121

117122
}

fineract-provider/dev-dependencies.gradle

+6-2
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,21 @@ dependencies {
100100
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
101101
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
102102
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
103-
103+
[group: 'org.apache.tika', name: 'tika-core', version :'1.9'],
104104
// Although fineract (at the time of writing) doesn't have any compile time dep. on this,
105105
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
106106
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
107107
// Once we've switched to Java 8 this dep can be removed.
108108
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
109+
[group: 'org.springframework', name:'spring-jms'],
110+
[group: 'org.apache.activemq', name: 'activemq-broker']
109111
)
110112
testCompile 'junit:junit:4.11',
111113
'junit:junit-dep:4.11',
112114
'org.mockito:mockito-core:1.9.5',
113115
'com.jayway.restassured:rest-assured:2.3.3',
114-
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion]
116+
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion],
117+
[group: 'com.mockrunner', name: 'mockrunner-jms', version: '1.0.6'],
118+
[group: 'com.mockrunner', name: 'mockrunner-jdbc', version: '1.0.6']
115119

116120
}

0 commit comments

Comments
 (0)