Skip to content

Commit

Permalink
Set HttpOnly and Secure response in our session cookie (updated)
Browse files Browse the repository at this point in the history
#186292877
  • Loading branch information
enyia21 committed Oct 20, 2023
1 parent 8b492b7 commit b66d205
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.session.web.http.DefaultCookieSerializer;
Expand All @@ -19,6 +18,7 @@ public class SecurityConfiguration {
public DefaultCookieSerializer setDefaultSecurityCookie(){
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
serializer.setUseSecureCookie(true);
serializer.setUseHttpOnlyCookie(true);
return serializer;
}
@Bean
Expand Down

0 comments on commit b66d205

Please sign in to comment.