|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.feide.moria.directory.DirectoryManager
public class DirectoryManager
The Directory Manager (sometimes referred to as DM) component in Moria 2. Responsible for all backend operations, such as user authentication and attribute retrieval from the backend sources.
Field Summary | |
---|---|
private DirectoryManagerBackendFactory |
backendFactory
Internal representation of the backend factory. |
private DirectoryManagerConfiguration |
configuration
The currently used (valid) Directory Manager configuration. |
private DirectoryManagerIndex |
index
Internal representation of the index. |
private java.util.Timer |
indexTimer
This timer uses IndexUpdater to periodically call
updateIndex() . |
private no.feide.moria.log.MessageLogger |
log
The message logger. |
Constructor Summary | |
---|---|
DirectoryManager()
|
Method Summary | |
---|---|
java.util.HashMap |
authenticate(java.lang.String sessionTicket,
Credentials userCredentials,
java.lang.String[] attributeRequest)
Forwards an authentication attempt to the underlying backend. |
void |
destroy()
Destructor. |
java.lang.String |
getRealm(java.lang.String username)
Resolves the realm of a given username. |
void |
setConfig(java.util.Properties config)
Sets or updates the Directory Manager's configuration. |
void |
stop()
Stops the Directory Manager. |
protected void |
updateIndex(DirectoryManagerIndex newIndex)
Sets or updates the internal index structure. |
boolean |
userExists(java.lang.String sessionTicket,
java.lang.String username)
Checks that a user actually exists by querying the underlying backend. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final no.feide.moria.log.MessageLogger log
private DirectoryManagerIndex index
private java.util.Timer indexTimer
IndexUpdater
to periodically call
updateIndex()
.
private DirectoryManagerBackendFactory backendFactory
private DirectoryManagerConfiguration configuration
Constructor Detail |
---|
public DirectoryManager()
Method Detail |
---|
public final void destroy()
stop()
.
stop()
public final void setConfig(java.util.Properties config)
IndexUpdater.readIndex()
.
config
- The configuration. The actual parsing is done by the
DirectoryManagerConfiguration
constructor.
DirectoryManagerConfigurationException
- If unable create a new configuration object from config or
config is null, and also not able to fall back to a previous
working configuration to fall back to (in which case a
warning will be logged instead). Also thrown if unable to
resolve the backend factory class (as specified in the
configuration file) or if unable to instantiate this class.DirectoryManagerConfiguration.DirectoryManagerConfiguration(Properties)
,
IndexUpdater.readIndex()
protected final void updateIndex(DirectoryManagerIndex newIndex)
IndexUpdater.run()
to periodically update the index.
newIndex
- The new index object. A null
value is taken to
indicate that the index should not be updated.
DirectoryManagerConfigurationException
- If newIndex
is null
and the
index has not been previously set.IndexUpdater.run()
public final boolean userExists(java.lang.String sessionTicket, java.lang.String username) throws BackendException
sessionTicket
- Passed on to instances of DirectoryManagerBackend
,
for logging purposes. May be null
or an empty
string.username
- The username to look up.
true
if the user element corresponding to the
username actually exists, otherwise false
.
BackendException
- A subclass of BackendException
is thrown if
there was a problem accessing the backend.
java.lang.IllegalStateException
- If attempting to use this method without successfully using
setConfig(Properties)
first.DirectoryManagerBackend.userExists(String)
public final java.util.HashMap authenticate(java.lang.String sessionTicket, Credentials userCredentials, java.lang.String[] attributeRequest) throws AuthenticationFailedException, BackendException, java.lang.IllegalStateException
sessionTicket
- Passed on to instances of DirectoryManagerBackend
,
for logging purposes. May be null
or an empty
string.userCredentials
- The user credentials passed on for authentication.attributeRequest
- An array containing the attribute names requested for
retrieval after successful authentication.
String
objects, while
the values will be String
arrays containing one or
more attribute values. Note that if any of the requested
attributes could not be retrieved from the backend following a
successful authentication (for example, if they simply do not
exist in the backend in question), the HashMap
will still include those attributes that could be
retrieved. If no attributes were requested, or if no attributes
were retrievable from the backend, an empty HashMap
will be returned. This still indicates a successful
authentication.
BackendException
- A subclass of BackendException
is thrown if
there was a problem accessing the backend.
AuthenticationFailedException
- If we managed to access the backend, and the authentication
failed. In other words, the user credentials are incorrect.
Also thrown if the user credentials are null
.
java.lang.IllegalStateException
- If attempting to use this method without successfully using
setConfig(Properties)
first.setConfig(Properties)
,
DirectoryManagerBackend.authenticate(Credentials, String[])
public final java.lang.String getRealm(java.lang.String username)
username
- The username to check.
null
if no such realm can be
resolved.DirectoryManagerIndex.getRealm(String)
public final void stop()
stop()
, but this is discouraged.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |