-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Clear null authentication to fix ThreadLocal leak #9877
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,12 @@ public interface SecurityContextHolderStrategy { | |
*/ | ||
SecurityContext getContext(); | ||
|
||
/** | ||
* Peeks the current context without creating an empty context. | ||
* @return a context (may be <code>null</code>) | ||
*/ | ||
SecurityContext peekContext(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For backward compatibility, this will need to have a default implementation. Please see #1890 (comment) for more details on the recommended implementation. |
||
|
||
/** | ||
* Sets the current context. | ||
* @param context to the new argument (should never be <code>null</code>, although | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,11 @@ public SecurityContext getContext() { | |
return ctx; | ||
} | ||
|
||
@Override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will you please update the copyright message for each edited file to include the year |
||
public SecurityContext peekContext() { | ||
return contextHolder.get(); | ||
} | ||
|
||
@Override | ||
public void setContext(SecurityContext context) { | ||
Assert.notNull(context, "Only non-null SecurityContext instances are permitted"); | ||
|
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.
For each new public method that you introduce, will you please add
@since 5.6
to the JavaDoc?