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
NOTE: This was originally brought up as a question in gh-8322 this ticket is to resolve that question
Ideally we would provide Authentication implementations that are immutable to avoid race conditions. However, for historical reasons it is unfortunate that both Authentication and SecurityContext are mutable.
We should look into how we can make both of these immutable
Regarding SecurityContext, I think SecurityContextImpl should add a constructor that takes Authentication, and its setAuthentication method should be deprecated.
It's not really clear to me why the SecurityContextHolderStrategy has a createEmptyContext (instead of apps constructing a security context directly); however, if it's important to route construction through SecurityContextHolder, then adding something like SecurityContextHolder#createContext(Authentication) could address that.
Summary
NOTE: This was originally brought up as a question in gh-8322 this ticket is to resolve that question
Ideally we would provide
Authentication
implementations that are immutable to avoid race conditions. However, for historical reasons it is unfortunate that bothAuthentication
andSecurityContext
are mutable.We should look into how we can make both of these immutable
setAuthenticated
from implementationsSecurityContextHolder#setAuthentication
SecurityContext#setAuthentication
SecurityContextHolderStrategy#createSecurityContext(Authentication)
The text was updated successfully, but these errors were encountered: