-
Notifications
You must be signed in to change notification settings - Fork 41.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Cookie's SameSite directive property #20912
Add Cookie's SameSite directive property #20912
Conversation
@cleankod Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@cleankod Thank you for signing the Contributor License Agreement! |
Thanks for your contribution @cleankod - did you see @vpavic commenting on the related issue? It seems this change goes against the general opinion. See this comment. Do you have new elements supporting this in the meantime? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in #15047, until Servlet API rolls out SameSite support, binding a property from server.servlet.session.cookie
namespace to something Spring Session specific isn't desirable IMO.
@bclozel, @vpavic I made this PR because when the time comes and the Servlet API releases the attribute as well, it would be completely transparent to me and all I'd need to do is upgrade Spring Boot. Now, without the possibility to set this via property, it leaves me with the necessity to provide a I completely understand your reason, but in such cases I would consider leaning towards Spring Boot users since the update of Servlet API is surely coming because this directive became an official one and can be found in the specification. Waiting for Servlet API requires us to walk our way around this problem. I'd therefore like to ask you to reconsider. If you stand by your decision anyway, then please consider merging my PR after the prerequisite Servlet API is released, so my work doesn't go to waste. |
I don't think it's reasonable to expect Spring Boot to introduce a property under a Servlet API specific configuration property namespace for a thing that currently isn't by Servlet API and that requires an additional library (Spring Session) to be able to use it. First and foremost, this is wrong as it's not usable if one's using Servlet container's default session management capabilities. Additionally, to my knowledge at least, the Servlet API support isn't imminent by any means and won't happen before I've proposed an alternative approach in #20961. This would add the capability to customize the SameSite setting of Spring Session's @Bean
CookieSerializerCustomizer cookieSerializerCustomizer() {
return cookieSerializer -> cookieSerializer.setSameSite("None");
} |
See #15047
Added the ability to configure the
DefaultCookieSerializer
'sSameSite
directive with an application property.Fixes #15047