You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since listening for security context changes happens at the strategy level, SecurityContextHolder#addListener leaks that abstraction.
Instead, let's replace addListener with setSecurityContextHolderStrategy and make ListeningSecurityContextHolderStrategy public. This will allow the listening support to remain with the strategy.
ListeningSecurityContextHolderStrategy should not need to peek the SecurityContext since the semantic difference between a null SecurityContext and one with a null Authentication is negligible.
An additional benefit to setSecurityContextHolderStrategy over addListener is that it simplifies removing a custom strategy that has references to objects that need garbage collecting.
The text was updated successfully, but these errors were encountered:
Since listening for security context changes happens at the strategy level,
SecurityContextHolder#addListener
leaks that abstraction.Instead, let's replace
addListener
withsetSecurityContextHolderStrategy
and makeListeningSecurityContextHolderStrategy
public. This will allow the listening support to remain with the strategy.ListeningSecurityContextHolderStrategy
should not need to peek theSecurityContext
since the semantic difference between a nullSecurityContext
and one with a nullAuthentication
is negligible.An additional benefit to
setSecurityContextHolderStrategy
overaddListener
is that it simplifies removing a custom strategy that has references to objects that need garbage collecting.The text was updated successfully, but these errors were encountered: