In response to this question securitycontextholder-session-or-request-bound. I was implementing CustomAuthenticationManager using this example how-to-customAuthenticationManager. It turns out, my user experience get Accross Session.
For example, User A interacts with web App, sometimes when accessing profile, User A could get User B Profile(this because the app is retrieving UserProfileLoggedIn from SecurityContextHolder's principal and accessing database) and at the same time User B was logged on, but probably not accessing profile.
I wonder is this a SecurityContextHolder leakage ? I know that SecurityContextHolder is just a way of implement HttpSession as a container to contain userDetails and so on.
Now, after having the problems, I'm changing the customAuthenticationManager to customAuthenticationProvider. For additional information, the users is around 100-500 concurrent users at mid day.
For additional information, I'm implementing SecurityContextHolder in my @Service Class, so another team member can get easily
@Service
public MyServiceImpl implement MyServiceInterface{
public UserDetail findUser(){
return (UserDetail) SecurityContextHolder.getContext().
getAuthentication().getPrincipal();
}
}