-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Fix defaults description in Session Management doc #18345
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
base: main
Are you sure you want to change the base?
Conversation
Corrected that starting from Spring Security 6 security context is not automatically saved by default. Signed-off-by: sankranti <[email protected]>
| Once you have got an application that is xref:servlet/authentication/index.adoc[authenticating requests], it is important to consider how that resulting authentication will be persisted and restored on future requests. | ||
|
|
||
| This is done automatically by default, so no additional code is necessary, though it is important to know what `requireExplicitSave` means in `HttpSecurity`. | ||
| Starting from Spring Security 6 security context is not persisted automatically by default, thus it is important to know what `requireExplicitSave` means in `HttpSecurity`. |
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.
Starting from Spring Security 6,(add comma)
jzheaux
left a comment
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.
Hi, @sankranty, thanks for the PR. I agree that this could be clearer. I've left my suggestions inline.
| Once you have got an application that is xref:servlet/authentication/index.adoc[authenticating requests], it is important to consider how that resulting authentication will be persisted and restored on future requests. | ||
|
|
||
| This is done automatically by default, so no additional code is necessary, though it is important to know what `requireExplicitSave` means in `HttpSecurity`. | ||
| Starting from Spring Security 6 security context is not persisted automatically by default, thus it is important to know what `requireExplicitSave` means in `HttpSecurity`. |
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.
While this first sentence could possibly be clearer, it's not true that the security context is not persisted by default.
The important change from 5 to 6 was that the SecurityContextPersistenceFilter would not automatically attempt to save the security context for you. It is still true, though, that each Spring Security filter that interacts with the Security Context will persist it as needed (instead of all of them relying on one filter).
Perhaps the following:
This is done automatically by default. If you have a custom filter or controller that is setting the security context, you will need to use a `SecurityContextRepository` to persist it across requests.
If you are upgrading from an older version, you may be interested in the `requireExplicitSave` setting that preserves Spring Security 5's default, though note that this is primarily for migration purposes.
Corrected that starting from Spring Security 6 security context is not automatically saved by default.