Added method getLoggedUser() in SecurityUtils class
This commit is contained in:
parent
6d28f88394
commit
a1a980b3a7
1 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import org.navalplanner.business.users.entities.UserRole;
|
||||
import org.navalplanner.web.users.bootstrap.MandatoryUser;
|
||||
import org.navalplanner.web.users.services.CustomUser;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +36,7 @@ import org.zkoss.zk.ui.Executions;
|
|||
*
|
||||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
* @author Jacobo Aragunde Perez <jaragunde@igalia.com>
|
||||
* @author Cristina Alvarino Perez <cristina.alvarino@comtecsf.es>
|
||||
*/
|
||||
public final class SecurityUtils {
|
||||
|
||||
|
|
@ -53,4 +56,8 @@ public final class SecurityUtils {
|
|||
return principal.getName();
|
||||
}
|
||||
|
||||
public final static CustomUser getLoggedUser() {
|
||||
return (CustomUser) SecurityContextHolder.getContext()
|
||||
.getAuthentication().getPrincipal();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue