Skip to content

Commit 952a427

Browse files
authored
Merge pull request #227 from xdev-software/develop
Release
2 parents fd6206a + 1421539 commit 952a427

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 1.5.1
2-
* Fix HSTS customization logic not working as expected
1+
# 1.5.2
2+
* Improve default HSTS customization logic
33

44
# 1.5.0
55
* Vaadin

web/src/main/java/software/xdev/sse/web/hsts/DefaultHstsApplier.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ public DefaultHstsApplier(
5050
final HstsConfig config,
5151
@Nullable final Ssl ssl)
5252
{
53-
this.enabled = Boolean.TRUE.equals(config.isEnabled())
54-
|| ssl != null && ssl.isEnabled();
53+
this.enabled = determineIfEnabled(config, ssl);
5554
LOG.debug("HSTS enabled={}", this.enabled);
5655
}
5756

57+
protected static boolean determineIfEnabled(
58+
final HstsConfig config,
59+
@Nullable final Ssl ssl)
60+
{
61+
if(config != null && config.isEnabled() != null)
62+
{
63+
return config.isEnabled();
64+
}
65+
return ssl != null && ssl.isEnabled();
66+
}
67+
5868
@Override
5969
public HeadersConfigurer<HttpSecurity> apply(final HeadersConfigurer<HttpSecurity> c)
6070
{

0 commit comments

Comments
 (0)