File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
web/src/main/java/software/xdev/sse/web/cookie Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1515 */
1616package software .xdev .sse .web .cookie ;
1717
18- import jakarta .annotation .PostConstruct ;
19-
2018import org .slf4j .Logger ;
2119import org .slf4j .LoggerFactory ;
22- import org .springframework .beans .factory .annotation .Value ;
2320
2421
2522public class DefaultCookieSecureService implements CookieSecureService
@@ -33,12 +30,11 @@ public class DefaultCookieSecureService implements CookieSecureService
3330 * https://www.baeldung.com/spring-security-session
3431 * </a>
3532 */
36- @ Value ("${server.servlet.session.cookie.secure:true}" )
37- private boolean secure ;
33+ private final boolean secure ;
3834
39- @ PostConstruct
40- protected void postConstruct ()
35+ public DefaultCookieSecureService (final boolean secure )
4136 {
37+ this .secure = secure ;
4238 if (!this .secure )
4339 {
4440 LOG .info ("Cookies will NOT be secured (as defined in 'server.servlet.session.cookie.secure')" );
Original file line number Diff line number Diff line change 1515 */
1616package software .xdev .sse .web .cookie .auto ;
1717
18+ import org .springframework .beans .factory .annotation .Value ;
1819import org .springframework .boot .autoconfigure .AutoConfiguration ;
1920import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
2021import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
@@ -31,9 +32,10 @@ public class CookieAutoConfig
3132{
3233 @ ConditionalOnMissingBean
3334 @ Bean
34- public CookieSecureService cookieSecureService ()
35+ public CookieSecureService cookieSecureService (
36+ @ Value ("${server.servlet.session.cookie.secure:true}" ) final boolean secure )
3537 {
36- return new DefaultCookieSecureService ();
38+ return new DefaultCookieSecureService (secure );
3739 }
3840
3941 @ ConditionalOnMissingBean
You can’t perform that action at this time.
0 commit comments