com.ecyrd.jspwiki.auth
Class WikiPrincipal

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

public final class WikiPrincipal
extends Object
implements Principal

A lightweight, immutable Principal class.

Since:
2.2
Version:
$Revision: 1.8 $ $Date: 2005/11/08 18:19:43 $
Author:
Janne Jalkanen, Andrew Jaquith

Nested Class Summary
static class WikiPrincipal.PrincipalComparator
          Tiny little class that compares objects of type Principal.
 
Field Summary
static Comparator COMPARATOR
           
static String FULL_NAME
           
static Principal GUEST
          Represents an anonymous user.
static String LOGIN_NAME
           
static String UNSPECIFIED
           
static String WIKI_NAME
           
 
Constructor Summary
WikiPrincipal(String name)
          Constructs a new WikiPrincipal with a given name and a type of UNSPECIFIED.
WikiPrincipal(String name, String type)
          Constructs a new WikiPrincipal with a given name and optional type designator.
 
Method Summary
 boolean equals(Object obj)
          Two WikiPrincipals are considered equal if their names are equal (case-sensitive).
 String getName()
          Returns the wiki name of the Principal.
 String getType()
          Returns the Principal "type": LOGIN_NAME, FULL_NAME, WIKI_NAME or WIKI_NAME
 String toString()
          Returns a human-readable representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
hashCode
 

Field Detail

GUEST

public static final Principal GUEST
Represents an anonymous user. WikiPrincipals may be created with an optional type designator: LOGIN_NAME, WIKI_NAME, FULL_NAME or UNSPECIFIED.


FULL_NAME

public static final String FULL_NAME
See Also:
Constant Field Values

LOGIN_NAME

public static final String LOGIN_NAME
See Also:
Constant Field Values

WIKI_NAME

public static final String WIKI_NAME
See Also:
Constant Field Values

UNSPECIFIED

public static final String UNSPECIFIED
See Also:
Constant Field Values

COMPARATOR

public static final Comparator COMPARATOR
Constructor Detail

WikiPrincipal

public WikiPrincipal(String name)
Constructs a new WikiPrincipal with a given name and a type of UNSPECIFIED.

Parameters:
name - the name of the Principal

WikiPrincipal

public WikiPrincipal(String name,
                     String type)
Constructs a new WikiPrincipal with a given name and optional type designator.

Parameters:
name - the name of the Principal
type - the type for this principal, which may be LOGIN_NAME, FULL_NAME, WIKI_NAME or WIKI_NAME.
Throws:
IllegalArgumentException - if the type is not LOGIN_NAME, FULL_NAME, WIKI_NAME or WIKI_NAME
Method Detail

getName

public final String getName()
Returns the wiki name of the Principal.

Specified by:
getName in interface Principal

equals

public final boolean equals(Object obj)
Two WikiPrincipals are considered equal if their names are equal (case-sensitive).

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

getType

public String getType()
Returns the Principal "type": LOGIN_NAME, FULL_NAME, WIKI_NAME or WIKI_NAME


toString

public final String toString()
Returns a human-readable representation of the object.

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