FINERACT-2140: added hsts protocol support through system property
This commit is contained in:
+8
@@ -491,6 +491,7 @@ public class FineractProperties {
|
|||||||
private FineractSecurityBasicAuth basicauth;
|
private FineractSecurityBasicAuth basicauth;
|
||||||
private FineractSecurityTwoFactorAuth twoFactor;
|
private FineractSecurityTwoFactorAuth twoFactor;
|
||||||
private FineractSecurityOAuth oauth;
|
private FineractSecurityOAuth oauth;
|
||||||
|
private FineractSecurityHsts hsts;
|
||||||
|
|
||||||
public void set2fa(FineractSecurityTwoFactorAuth twoFactor) {
|
public void set2fa(FineractSecurityTwoFactorAuth twoFactor) {
|
||||||
this.twoFactor = twoFactor;
|
this.twoFactor = twoFactor;
|
||||||
@@ -518,6 +519,13 @@ public class FineractProperties {
|
|||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class FineractSecurityHsts {
|
||||||
|
|
||||||
|
private boolean enabled;
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class FineractTransactionProcessorItemProperties {
|
public static class FineractTransactionProcessorItemProperties {
|
||||||
|
|||||||
+4
@@ -128,6 +128,10 @@ public class OAuth2SecurityConfig {
|
|||||||
http.requiresChannel(channel -> channel.requestMatchers(antMatcher("/api/**")).requiresSecure());
|
http.requiresChannel(channel -> channel.requestMatchers(antMatcher("/api/**")).requiresSecure());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fineractProperties.getSecurity().getHsts().isEnabled()) {
|
||||||
|
http.requiresChannel(channel -> channel.anyRequest().requiresSecure()).headers(
|
||||||
|
headers -> headers.httpStrictTransportSecurity(hsts -> hsts.includeSubDomains(true).maxAgeInSeconds(31536000)));
|
||||||
|
}
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -158,6 +158,11 @@ public class SecurityConfig {
|
|||||||
if (serverProperties.getSsl().isEnabled()) {
|
if (serverProperties.getSsl().isEnabled()) {
|
||||||
http.requiresChannel(channel -> channel.requestMatchers(antMatcher("/api/**")).requiresSecure());
|
http.requiresChannel(channel -> channel.requestMatchers(antMatcher("/api/**")).requiresSecure());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fineractProperties.getSecurity().getHsts().isEnabled()) {
|
||||||
|
http.requiresChannel(channel -> channel.anyRequest().requiresSecure()).headers(
|
||||||
|
headers -> headers.httpStrictTransportSecurity(hsts -> hsts.includeSubDomains(true).maxAgeInSeconds(31536000)));
|
||||||
|
}
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ fineract.node-id=${FINERACT_NODE_ID:1}
|
|||||||
fineract.security.basicauth.enabled=${FINERACT_SECURITY_BASICAUTH_ENABLED:true}
|
fineract.security.basicauth.enabled=${FINERACT_SECURITY_BASICAUTH_ENABLED:true}
|
||||||
fineract.security.oauth.enabled=${FINERACT_SECURITY_OAUTH_ENABLED:false}
|
fineract.security.oauth.enabled=${FINERACT_SECURITY_OAUTH_ENABLED:false}
|
||||||
fineract.security.2fa.enabled=${FINERACT_SECURITY_2FA_ENABLED:false}
|
fineract.security.2fa.enabled=${FINERACT_SECURITY_2FA_ENABLED:false}
|
||||||
|
fineract.security.hsts.enabled=${FINERACT_SECURITY_HSTS_ENABLED:false}
|
||||||
|
|
||||||
fineract.tenant.host=${FINERACT_DEFAULT_TENANTDB_HOSTNAME:localhost}
|
fineract.tenant.host=${FINERACT_DEFAULT_TENANTDB_HOSTNAME:localhost}
|
||||||
fineract.tenant.port=${FINERACT_DEFAULT_TENANTDB_PORT:3306}
|
fineract.tenant.port=${FINERACT_DEFAULT_TENANTDB_PORT:3306}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ fineract.node-id=1
|
|||||||
fineract.security.basicauth.enabled=true
|
fineract.security.basicauth.enabled=true
|
||||||
fineract.security.oauth.enabled=false
|
fineract.security.oauth.enabled=false
|
||||||
fineract.security.2fa.enabled=false
|
fineract.security.2fa.enabled=false
|
||||||
|
fineract.security.hsts.enabled=false
|
||||||
|
|
||||||
fineract.tenant.host=localhost
|
fineract.tenant.host=localhost
|
||||||
fineract.tenant.port=3306
|
fineract.tenant.port=3306
|
||||||
|
|||||||
Reference in New Issue
Block a user