jsf - Spring Security Current User Session Bean -


When you work with Spring Security, you usually store an existing user in a session variable or you Want to use some user information every time you press DB?

At the moment I do the following but it looks useless:

  public class current user service {personal user user; Public current user service (UserUserDesign) {super (); This.userDAO = userDAO; } Public user getUser () {string user name = SecurityContextHolder.getContext (). GetAuthentication (). GetName (); Return user drawer (user name); }}  

Spring security Automatically authenticate user objects stored in session by default Will configure One of the first things in the safety filter chain checks for a valid authentication token session, if present, it copies the security context with it and any new authentication filter Leaves you only have to write your UserDetailsService and the filter chain should be on the other side.


Comments