|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.feide.moria.directory.backend.DummyBackend
public class DummyBackend
Hard-coded dummy backend, for testing. Does not require an actual backend source.
Field Summary | |
---|---|
private java.util.HashMap |
users
Maps user names (converted to lowercase) to DummyUser
elements. |
Fields inherited from interface no.feide.moria.directory.backend.DirectoryManagerBackend |
---|
ATTRIBUTE_VALUE_CHARSET, VIRTUAL_ATTRIBUTES |
Constructor Summary | |
---|---|
protected |
DummyBackend(org.jdom.Element config)
Protected constructor. |
Method Summary | |
---|---|
java.util.HashMap |
authenticate(Credentials userCredentials,
java.lang.String[] attributeRequest)
Authenticates a user, if the user exists and the username equals the password. |
void |
close()
Does nothing, but needed to fulfill the DirectoryManagerBackend interface. |
void |
open(IndexedReference[] references)
Does nothing, but needed to fulfill the DirectoryManagerBackend interface. |
boolean |
userExists(java.lang.String username)
Checks whether a user exists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap users
DummyUser
elements.
Constructor Detail |
---|
protected DummyBackend(org.jdom.Element config)
config
- A Backend
configuration element. Must contain a
Dummy
element (if more than one only the first
is considered), which is expected to contain one or more
User
elements, each with one or more
Attribute
elements, which again have
Value
elements with exactly one value child.
Allows for easy configuration of test cases, without having to
rely on an external backend source. See the supplied dummy
configuration for a workable example. Note that attribute and
user names are case insensitive, while attribute values are
stored as specified in the configuration.
DirectoryManagerConfigurationException
- If config lacks a mandatory element.Method Detail |
---|
public void open(IndexedReference[] references)
DirectoryManagerBackend
interface.
open
in interface DirectoryManagerBackend
references
- Ignored.DirectoryManagerBackend.open(IndexedReference[])
public final boolean userExists(java.lang.String username)
userExists
in interface DirectoryManagerBackend
username
- The username. Case is ignored.
DirectoryManagerBackend.userExists(String)
public final java.util.HashMap authenticate(Credentials userCredentials, java.lang.String[] attributeRequest) throws AuthenticationFailedException
authenticate
in interface DirectoryManagerBackend
userCredentials
- The user's credentials. Cannot be null
.attributeRequest
- A list of requested attributes from the user object. May be
null
or an empty array. Not case sensitive.
AuthenticationFailedException
- If the authentication fails.
java.lang.IllegalArgumentException
- If userCredentials are null
.DirectoryManagerBackend.authenticate(Credentials, String[])
public void close()
DirectoryManagerBackend
interface.
close
in interface DirectoryManagerBackend
DirectoryManagerBackend.close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |