|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.security.SimplePrincipal org.jboss.security.NestableGroup
public class NestableGroup
An implementation of Group that allows that acts as a stack of Groups with a single Group member active at any time. When one adds a Group to a NestableGroup the Group is pushed onto the active Group stack and any of the Group methods operate as though the NestableGroup contains only the Group. When removing the Group that corresponds to the active Group, the active Group is popped from the stack and the new active Group is set to the new top of the stack. The typical usage of this class is when doing a JAAS LoginContext login to runAs a new Principal with a new set of roles that should be added without destroying the current identity and roles.
Constructor Summary | |
---|---|
NestableGroup(String name)
Creates new NestableGroup with the given name |
Method Summary | |
---|---|
boolean |
addMember(Principal group)
Pushes the group onto the Group stack and makes it the active Group. |
Object |
clone()
|
boolean |
isMember(Principal member)
Returns true if the passed principal is a member of the active group. |
Enumeration |
members()
Returns an enumeration that contains the single active Principal. |
boolean |
removeMember(Principal user)
Removes the first occurence of user from the Principal stack. |
String |
toString()
|
Methods inherited from class org.jboss.security.SimplePrincipal |
---|
equals, getName, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.security.Principal |
---|
equals, getName, hashCode |
Constructor Detail |
---|
public NestableGroup(String name)
Method Detail |
---|
public Enumeration members()
members
in interface Group
public boolean removeMember(Principal user)
removeMember
in interface Group
user
- the principal to remove from this group.
public boolean addMember(Principal group) throws IllegalArgumentException
addMember
in interface Group
group
- the instance of Group that contains the roles to set as the
active Group.
IllegalArgumentException
- thrown if group is not an instance of Group.public boolean isMember(Principal member)
isMember
in interface Group
member
- the principal whose membership is to be checked.
public String toString()
toString
in interface Principal
toString
in class SimplePrincipal
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |