Compare commits
13 Commits
v0.35.0
...
pixeebot/s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72636dda9f | ||
|
|
329f755823 | ||
|
|
acc50e48c5 | ||
|
|
92a571d31c | ||
|
|
5976e69f54 | ||
|
|
e588d8f99e | ||
|
|
1c0f423510 | ||
|
|
2d6fe55985 | ||
|
|
5171088fca | ||
|
|
b4837df76c | ||
|
|
d20e8f7d54 | ||
|
|
2885fac30d | ||
|
|
2a4a19a80f |
@@ -1,5 +1,6 @@
|
|||||||
package stirling.software.SPDF.config.security;
|
package stirling.software.SPDF.config.security;
|
||||||
|
|
||||||
|
import io.github.pixee.security.Newlines;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -163,12 +164,31 @@ public class SecurityConfiguration {
|
|||||||
http.sessionManagement(
|
http.sessionManagement(
|
||||||
sessionManagement ->
|
sessionManagement ->
|
||||||
sessionManagement
|
sessionManagement
|
||||||
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
|
|
||||||
.maximumSessions(10)
|
.maximumSessions(10)
|
||||||
.maxSessionsPreventsLogin(false)
|
.maxSessionsPreventsLogin(false)
|
||||||
.sessionRegistry(sessionRegistry)
|
.sessionRegistry(sessionRegistry)
|
||||||
.expiredUrl("/login?logout=true"));
|
|
||||||
|
|
||||||
|
.expiredUrl("/login?logout=true"))
|
||||||
|
.addFilterBefore(
|
||||||
|
new ForceEagerSessionCreationFilter(),
|
||||||
|
SecurityContextHolderFilter.class)
|
||||||
|
.addFilterBefore(new ForceEagerSessionCreationFilter(), SecurityContextHolderFilter.class);
|
||||||
|
|
||||||
|
http.addFilterBefore(new OncePerRequestFilter() {
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request,
|
||||||
|
HttpServletResponse response, FilterChain filterChain)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
|
||||||
|
if (request.getRequestURI().startsWith("/saml2")) {
|
||||||
|
response.setHeader("Set-Cookie",
|
||||||
|
Newlines.stripAll(response.getHeader("Set-Cookie")
|
||||||
|
.concat(";SameSite=None;Secure")));
|
||||||
|
}
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
}, SessionManagementFilter.class);
|
||||||
|
|
||||||
http.authenticationProvider(daoAuthenticationProvider());
|
http.authenticationProvider(daoAuthenticationProvider());
|
||||||
http.requestCache(requestCache -> requestCache.requestCache(new NullRequestCache()));
|
http.requestCache(requestCache -> requestCache.requestCache(new NullRequestCache()));
|
||||||
http.logout(
|
http.logout(
|
||||||
@@ -452,6 +472,19 @@ public class SecurityConfiguration {
|
|||||||
.clientName("OIDC")
|
.clientName("OIDC")
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CookieSerializer cookieSerializer() {
|
||||||
|
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
||||||
|
serializer.setSameSite("None");
|
||||||
|
serializer.setUseSecureCookie(true); // Required when using SameSite=None
|
||||||
|
return serializer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HttpSessionEventPublisher httpSessionEventPublisher() {
|
||||||
|
return new HttpSessionEventPublisher();
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(
|
@ConditionalOnProperty(
|
||||||
|
|||||||
@@ -1386,13 +1386,6 @@
|
|||||||
"moduleLicense": "Apache License, Version 2.0",
|
"moduleLicense": "Apache License, Version 2.0",
|
||||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"moduleName": "org.springframework.session:spring-session-core",
|
|
||||||
"moduleUrl": "https://spring.io/projects/spring-session",
|
|
||||||
"moduleVersion": "3.4.0",
|
|
||||||
"moduleLicense": "Apache License, Version 2.0",
|
|
||||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"moduleName": "org.springframework:spring-aop",
|
"moduleName": "org.springframework:spring-aop",
|
||||||
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
"moduleUrl": "https://github.com/spring-projects/spring-framework",
|
||||||
|
|||||||
Reference in New Issue
Block a user