Class SubjectUtil
java.lang.Object
org.glassfish.security.services.common.SubjectUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetGroupnamesFromSubject
(Subject subject) Utility method to find the group names from a subject.getUsernamesFromSubject
(Subject subject) Utility method to find the user names from a subject.
-
Constructor Details
-
SubjectUtil
public SubjectUtil()
-
-
Method Details
-
getUsernamesFromSubject
Utility method to find the user names from a subject. The method assumes the user name is represented byUserPrincipal
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
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.
-