ecologylab.services.authentication
Class AuthenticationList<E extends AuthenticationListEntry>

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.xml.ElementState
          extended by ecologylab.services.authentication.AuthenticationList<E>
All Implemented Interfaces:
FieldTypes, XMLTranslationExceptionTypes

public class AuthenticationList<E extends AuthenticationListEntry>
extends ElementState

Contains a HashMap of AuthenticationListEntry's that are hashed on their username values. Raw passwords are never serialized using this object, only one-way hashes of them (see AuthenticationListEntry). Instances of this should be used by a server to determine valid usernames and passwords; generally, a serialized instance of this is used as a backing store for such servers. Most methods in this class are synchronized, so that they cannot be interleaved on multiple threads. This should prevent consistency errors.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)

Nested Class Summary
 
Nested classes/interfaces inherited from class ecologylab.xml.ElementState
ElementState.DeclarationStyle, ElementState.xml_attribute, ElementState.xml_bind_from, ElementState.xml_bind_to, ElementState.xml_class, ElementState.xml_classes, ElementState.xml_collection, ElementState.xml_format, ElementState.xml_leaf, ElementState.xml_map, ElementState.xml_nested, ElementState.xml_nowrap, ElementState.xml_other_tags, ElementState.xml_scope, ElementState.xml_tag, ElementState.xml_text
 
Field Summary
 
Fields inherited from class ecologylab.xml.ElementState
CDATA, NORMAL, UTF16, UTF16_LE, UTF8
 
Fields inherited from interface ecologylab.xml.FieldTypes
ATTRIBUTE, AWFUL_OLD_NESTED_ELEMENT, BAD_FIELD, COLLECTION_ELEMENT, COLLECTION_SCALAR, IGNORED_ATTRIBUTE, IGNORED_ELEMENT, LEAF, MAP_ELEMENT, MAP_SCALAR, NAME_SPACE_ATTRIBUTE, NAME_SPACE_LEAF_NODE, NAME_SPACE_MASK, NAME_SPACE_NESTED_ELEMENT, NAMESPACE_IGNORED_ELEMENT, NAMESPACE_TRIAL_ELEMENT, NESTED_ELEMENT, PSEUDO_FIELD_DESCRIPTOR, ROOT, TEXT_ELEMENT, TEXT_NODE_VALUE, UNSET_TYPE, WRAPPER, XMLNS_ATTRIBUTE, XMLNS_IGNORED
 
Fields inherited from interface ecologylab.xml.XMLTranslationExceptionTypes
FILE_NOT_FOUND, IO_EXCEPTION, NULL_PURL, UNKNOWN
 
Constructor Summary
AuthenticationList()
          No-argument constructor for XML translation.
 
Method Summary
 boolean add(E entry)
          Adds the given entry to this.
 java.lang.Object clone()
          Cloning AuthenticationLists is not allowed, because it is a security violation.
 boolean contains(AuthenticationListEntry entry)
          Checks to see if this contains the username given in entry; returns true if it does.
 boolean contains(java.lang.String username)
          Checks to see if this contains the given username; returns true if it does.
 int getAccessLevel(AuthenticationListEntry entry)
          Retrieves the access level for the given entry.
 boolean isValid(AuthenticationListEntry entry)
          Checks entry against the entries contained in this.
 boolean remove(AuthenticationListEntry entry)
          Attempts to remove the given object; this will succeed if and only if the following are true: 1.) the Object is of type AuthenticationListEntry 2.) this list contains the AuthenticationListEntry 3.) the AuthenticationListEntry's username and password both match the one in this list
 java.lang.String toString()
          Returns a String indicating the number of entries in the AuthenticationList.
 
Methods inherited from class ecologylab.xml.ElementState
buildDOM, buildDOM, buildDOM, buildDOM, buildDOM, buildDOMFromXMLCharSequence, buildDOMFromXMLString, checkAnnotation, classDescriptor, createParentDirs, getChildFieldAccessors, getElementStateById, getFieldDescriptors, getNestedNameSpace, getTextNodeString, hasScalarTextField, lookupNestedNameSpace, parent, recycle, setDeclarationStyle, setParent, setUseDOMForTranslateTo, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXMLCharSequence, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOMCharSequence, translateFromXMLDOMCharSequence, translateFromXMLRootNode, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateToDOM, translateToXML, translateToXML, translateToXML, translateToXML, writePrettyXML, writePrettyXML, writePrettyXML
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthenticationList

public AuthenticationList()
No-argument constructor for XML translation.

Method Detail

add

public boolean add(E entry)
Adds the given entry to this.


clone

public final java.lang.Object clone()
                             throws java.lang.UnsupportedOperationException
Cloning AuthenticationLists is not allowed, because it is a security violation. This method just throws an UnsupportedOperationException.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.UnsupportedOperationException

contains

public boolean contains(AuthenticationListEntry entry)
Checks to see if this contains the username given in entry; returns true if it does.

Parameters:
entry -
Returns:

contains

public boolean contains(java.lang.String username)
Checks to see if this contains the given username; returns true if it does.

Parameters:
username -
Returns:

getAccessLevel

public int getAccessLevel(AuthenticationListEntry entry)
Retrieves the access level for the given entry.

Parameters:
entry -
Returns:

isValid

public boolean isValid(AuthenticationListEntry entry)
Checks entry against the entries contained in this. Verifies that the username exists, and the password matches; returns true if both are true.

Parameters:
entry -
Returns:

remove

public boolean remove(AuthenticationListEntry entry)
Attempts to remove the given object; this will succeed if and only if the following are true: 1.) the Object is of type AuthenticationListEntry 2.) this list contains the AuthenticationListEntry 3.) the AuthenticationListEntry's username and password both match the one in this list

Parameters:
entry - the AuthenticationListEntry (username / password) to attempt to remove.

toString

public java.lang.String toString()
Returns a String indicating the number of entries in the AuthenticationList.

Overrides:
toString in class Debug