Retrieve the Current User
On the server side it may be necessary to retrieve the current user. Spring Security offers a SecurityContextHolder.
Ex:
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
GaeUserDetails user = (GaeUserDetails) auth.getPrincipal();
String userID = user.getUsername();
String fromEmail = user.getEmail();
No comments:
Post a Comment