Class SubjectUtil


  • public class SubjectUtil
    extends Object
    • Constructor Detail

      • SubjectUtil

        public SubjectUtil()
    • Method Detail

      • getUsernamesFromSubject

        public static List<String> getUsernamesFromSubject​(Subject subject)
        Utility method to find the user names from a subject. The method assumes the user name is represented by PrincipalImpl inside the Subject's principal set.
        Parameters:
        subject - the subject from which to find the user name
        Returns:
        a list of strings representing the user name. The list may have more than one entry if the subject's principal set contains more than one PrincipalImpl instances, or empty entry (i.e., anonymous user) if the subject's principal set contains no PrincipalImpl instances.
      • getGroupnamesFromSubject

        public static List<String> getGroupnamesFromSubject​(Subject subject)
        Utility method to find the group names from a subject. The method assumes the group name is represented by Group inside the Subject's principal set.
        Parameters:
        subject - the subject from which to find the username
        Returns:
        a list of strings representing the group names. The list may have more than one entry if the subject's principal set contains more than one Group instances, or empty entry if the subject's principal set contains no Group instances.