com.ecyrd.jspwiki.auth
Class GroupPrincipal

java.lang.Object
  extended by com.ecyrd.jspwiki.auth.GroupPrincipal
All Implemented Interfaces:
Principal

public class GroupPrincipal
extends Object
implements Principal

Implements an immutable Principal that represents a Group. GroupPrincipals are injected into a Subject's principal list at the time of authentication (login), and serve as proxies for Group objects for the purposes of making Java 2 security policy decisions. We add GroupPrincipals instead of the actual Groups because calling classes should never be able to obtain a volatile Principal. Administrators who wish to grant privileges to wiki groups via the security policy file should always specify principals of type GroupPrincipal, notGroup.

Since:
2.3.79
Version:
$Revision: 1.1 $ $Date: 2006/02/21 08:32:06 $
Author:
Andrew Jaquith

Constructor Summary
GroupPrincipal(Group group)
          Constructs a new GroupPrincipal object.
GroupPrincipal(String group)
          Constructs a new GroupPrincipal object.
 
Method Summary
 boolean equals(Object obj)
          Two GroupPrincipals are equal if their names are equal.
 String getName()
          Returns the name of the group principal.
 int hashCode()
          Returns the hashcode for this object.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupPrincipal

public GroupPrincipal(Group group)
Constructs a new GroupPrincipal object.

Parameters:
group - the wiki group; cannot be null

GroupPrincipal

public GroupPrincipal(String group)
Constructs a new GroupPrincipal object.

Parameters:
group - the wiki group; cannot be null
Method Detail

getName

public String getName()
Returns the name of the group principal.

Specified by:
getName in interface Principal
See Also:
Principal.getName()

equals

public boolean equals(Object obj)
Two GroupPrincipals are equal if their names are equal.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns the hashcode for this object.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Returns a string representation of this object.

Specified by:
toString in interface Principal
Overrides:
toString in class Object
See Also:
Object.toString()