Package com.openkm.util
Class PrincipalUtils
- java.lang.Object
-
- com.openkm.util.PrincipalUtils
-
public class PrincipalUtils extends Object
- Author:
- pavila
-
-
Constructor Summary
Constructors Constructor Description PrincipalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.springframework.security.core.AuthenticationcreateAuthentication(String user, Set<String> roles)Create authentication tokenstatic org.springframework.security.core.AuthenticationgetAuthentication()Obtain authentication tokenstatic Set<String>getRoles()Obtain the list of user roles.static StringgetUser()Obtain the logged user.static StringgetUser(org.springframework.security.core.Authentication auth)Get user from Authentication infostatic booleanhasRole(String role)Check for rolestatic voidsetAuthentication(org.springframework.security.core.Authentication auth)Set authentication token
-
-
-
Method Detail
-
getUser
public static String getUser()
Obtain the logged user.
-
getUser
public static String getUser(org.springframework.security.core.Authentication auth)
Get user from Authentication info
-
hasRole
public static boolean hasRole(String role)
Check for role
-
getAuthentication
public static org.springframework.security.core.Authentication getAuthentication()
Obtain authentication token
-
setAuthentication
public static void setAuthentication(org.springframework.security.core.Authentication auth)
Set authentication token
-
-