View Javadoc

1   /***
2    * 
3    */
4   package hu.elte.tribus.util;
5   
6   import org.acegisecurity.context.SecurityContextHolder;
7   import org.acegisecurity.userdetails.UserDetails;
8   
9   /***
10   * @author kocka
11   *
12   */
13  public class AuthUtil {
14  	public static String getCurentUserName() {
15  		if(SecurityContextHolder.getContext().getAuthentication() == null)
16  			return null;
17  		return ((UserDetails)SecurityContextHolder.getContext().getAuthentication()
18  				.getPrincipal()).getUsername();
19  	}
20  }