Class SubjectUtil
- java.lang.Object
-
- org.glassfish.security.services.common.SubjectUtil
-
public class SubjectUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description SubjectUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>
getGroupnamesFromSubject(Subject subject)
Utility method to find the group names from a subject.static List<String>
getUsernamesFromSubject(Subject subject)
Utility method to find the user names from a subject.
-
-
-
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 byPrincipalImpl
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 byGroup
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.
-
-