you mean something like this:
public User getLoggedInUser() {
User currentUser = null;
final SecurityContext ctx = SecurityContextHolder.getContext();
if (ctx.getAuthentication() != null) {
final Authentication auth = ctx.getAuthentication();
if (auth.getPrincipal() instanceof UserDetails) {
currentUser = (User) auth.getPrincipal();
} else if (auth.getDetails() instanceof UserDetails) {
currentUser = (User) auth.getDetails();
} else {
throw new AccessDeniedException("User not properly
authenticated.");
}
}
return currentUser;
}
lounnaci wrote:
> How can i recuperate the user logged in name using struts?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]