FINERACT-2140: added hsts protocol support through system property
This commit is contained in:
+4
@@ -128,6 +128,10 @@ public class OAuth2SecurityConfig {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -158,6 +158,11 @@ public class SecurityConfig {
|
||||
if (serverProperties.getSsl().isEnabled()) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ fineract.node-id=${FINERACT_NODE_ID:1}
|
||||
fineract.security.basicauth.enabled=${FINERACT_SECURITY_BASICAUTH_ENABLED:true}
|
||||
fineract.security.oauth.enabled=${FINERACT_SECURITY_OAUTH_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.port=${FINERACT_DEFAULT_TENANTDB_PORT:3306}
|
||||
|
||||
@@ -22,6 +22,7 @@ fineract.node-id=1
|
||||
fineract.security.basicauth.enabled=true
|
||||
fineract.security.oauth.enabled=false
|
||||
fineract.security.2fa.enabled=false
|
||||
fineract.security.hsts.enabled=false
|
||||
|
||||
fineract.tenant.host=localhost
|
||||
fineract.tenant.port=3306
|
||||
|
||||
Reference in New Issue
Block a user