Class PrincipalUtils


  • public class PrincipalUtils
    extends Object
    Author:
    pavila
    • Constructor Detail

      • PrincipalUtils

        public PrincipalUtils()
    • 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
      • getRoles

        public static Set<String> getRoles()
        Obtain the list of user roles.
      • 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
      • createAuthentication

        public static org.springframework.security.core.Authentication createAuthentication​(String user,
                                                                                            Set<String> roles)
        Create authentication token