no.feide.moria.directory.backend
Class DummyUser

java.lang.Object
  extended by no.feide.moria.directory.backend.DummyUser

public class DummyUser
extends java.lang.Object

Used to internally represent a user in the DummyBackend class.


Field Summary
private  java.util.HashMap myAttributes
          This user's attributes.
private  java.lang.String myPassword
          This user's password.
private  java.lang.String myUsername
          This user's username.
 
Constructor Summary
DummyUser(java.lang.String username, java.lang.String password, java.util.HashMap attributes)
          Constructor.
 
Method Summary
 boolean authenticate(java.lang.String username, java.lang.String password)
          "Authenticates" this user, by doing a case-insensitive match on username and case-sensitive match on password.
 java.util.HashMap getAttributes(java.lang.String[] request)
          Gets this user's attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAttributes

private java.util.HashMap myAttributes
This user's attributes. The keys are attribute names as Strings and the values are attribute values as Lists.


myUsername

private java.lang.String myUsername
This user's username.


myPassword

private java.lang.String myPassword
This user's password.

Constructor Detail

DummyUser

public DummyUser(java.lang.String username,
                 java.lang.String password,
                 java.util.HashMap attributes)
Constructor.

Parameters:
username - The username. Cannot be null.
password - The password. Cannot be null.
attributes - The user's attributes, if any. Should contain attribute names as keys (Strings) and attribute values as values (Lists).
Throws:
java.lang.IllegalArgumentException - If username or password is null.
Method Detail

authenticate

public final boolean authenticate(java.lang.String username,
                                  java.lang.String password)
"Authenticates" this user, by doing a case-insensitive match on username and case-sensitive match on password.

Parameters:
username - The username to match. Cannot be null.
password - The password to match. Cannot be null.
Returns:
true if authentication succeeds, false otherwise.
Throws:
java.lang.IllegalArgumentException - If username or password is null.

getAttributes

public final java.util.HashMap getAttributes(java.lang.String[] request)
Gets this user's attributes.

Parameters:
request - The attribute request. Case is ignored.
Returns:
The requested user's attributes, if any were found. Note that the attribute names returned will match the case of the attribute names in the request.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.