DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.security.auth
Class TypedPrincipal

java.lang.Object
  extended by org.dlese.dpc.schemedit.security.auth.TypedPrincipal
All Implemented Interfaces:
Serializable, Principal
Direct Known Subclasses:
AuthPrincipal, UserPrincipal

public class TypedPrincipal
extends Object
implements Principal, Serializable

This class is based on the Tagish JAAS Login Modules (http://thekirschners.com/tagish-jaas/), and extended only to add "COLLECTION" and "AUTH" principles. TypedPrincipals are derived from, and can be treated like Principals but they also contain extra information about the type of the Principal which can be USER, GROUP or DOMAIN. I'm not 100% certain that this is a good way of doing things. Suggestions welcome.

Version:
1.0.3
Author:
Andy Armstrong
See Also:
Serialized Form

Field Summary
static int AUTH
          This TypedPrincipal represents an authentication method.
static int COLLECTION
           
static int DOMAIN
          This TypedPrincipal represents the domain name or SID.
static int GROUP
          This TypedPrincipal represents a group name or SID.
protected  String name
           
protected  int type
           
protected static String[] typeMap
           
static int UNKNOWN
          This TypedPrincipal represents an item of unknown type.
static int USER
          This TypedPrincipal represents a username or SID.
 
Constructor Summary
TypedPrincipal()
          Create a TypedPrincipal with a blank name.
TypedPrincipal(String name)
          Create a TypedPrincipal with a name.
TypedPrincipal(String name, int type)
          Create a TypedPrincipal with a name and type.
 
Method Summary
 boolean equals(Object o)
          Compares the specified Object with this TypedPrincipal for equality.
 String getName()
          Return the name for this TypedPrincipal.
 int getType()
          Return the type for this TypedPrincipal.
 String getTypeName()
          Return the name of the type for this TypedPrincipal.
 int hashCode()
          Return a hash code for this TypedPrincipal.
 void setName(String name)
           
 void setType(int type)
           
 String toString()
          Return a string representation of this TypedPrincipal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

type

protected int type

USER

public static final int USER
This TypedPrincipal represents a username or SID.

See Also:
Constant Field Values

DOMAIN

public static final int DOMAIN
This TypedPrincipal represents the domain name or SID.

See Also:
Constant Field Values

GROUP

public static final int GROUP
This TypedPrincipal represents a group name or SID.

See Also:
Constant Field Values

COLLECTION

public static final int COLLECTION
See Also:
Constant Field Values

AUTH

public static final int AUTH
This TypedPrincipal represents an authentication method.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
This TypedPrincipal represents an item of unknown type.

See Also:
Constant Field Values

typeMap

protected static final String[] typeMap
Constructor Detail

TypedPrincipal

public TypedPrincipal(String name,
                      int type)
Create a TypedPrincipal with a name and type.

Parameters:
name - the name for this principal.
type - the type for this principal.
Throws:
NullPointerException - if the name is null.

TypedPrincipal

public TypedPrincipal(String name)
Create a TypedPrincipal with a name.

Parameters:
name - the name for this Principal.
Throws:
NullPointerException - if the name is null.

TypedPrincipal

public TypedPrincipal()
Create a TypedPrincipal with a blank name.

Method Detail

setType

public void setType(int type)

setName

public void setName(String name)

getName

public String getName()
Return the name for this TypedPrincipal.

Specified by:
getName in interface Principal
Returns:
the name for this TypedPrincipal

getType

public int getType()
Return the type for this TypedPrincipal.

Returns:
the type for this TypedPrincipal

getTypeName

public String getTypeName()
Return the name of the type for this TypedPrincipal.

Returns:
the name of the type for this TypedPrincipal

toString

public String toString()
Return a string representation of this TypedPrincipal.

Specified by:
toString in interface Principal
Overrides:
toString in class Object
Returns:
a string representation of this TypedPrincipal.

equals

public boolean equals(Object o)
Compares the specified Object with this TypedPrincipal for equality. Returns true if the given object is also a TypedPrincipal and the two TypedPrincipals have the same name and type. If the object is any other kind Principal its will be considered equal if the name matches.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
o - Object to be compared for equality with this TypedPrincipal.
Returns:
true if the specified Object is equal to this TypedPrincipal.

hashCode

public int hashCode()
Return a hash code for this TypedPrincipal.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
a hash code for this TypedPrincipal.

DLESE Tools
v1.6.0