Class SubjectUtil

java.lang.Object
org.glassfish.security.services.common.SubjectUtil

public class SubjectUtil extends Object
  • Constructor Details

    • SubjectUtil

      public SubjectUtil()
  • Method Details

    • 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 UserPrincipal 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 UserPrincipal instances, or empty entry (i.e., anonymous user) if the subject's principal set contains no UserPrincipal 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.