All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.webmacro.resource.UserProvider
You should implement your own UserProvider using a database or other source, as this one is not particularly good. It's provided as an example so that you can write one that is compatible with code that may want to use it.
It is recommended that implementations of the "user" resource be compatible (from a ResourceProvider standpoint) with this one. That way WebMacro developers can write applications using the "user" resource type and be independent of the actual mechanism used to save and retreive User objects.
This implementation is fairly limited. It simply maintains a hashtable of users, which it serializes out to disk on shutdown, and reads on startup. This has obvious performance problems if you intend to have a large number of users. It does, however, store passwords as a cryptographically strong one-way hash so that they are not accessible to people who manage to get a copy of the underlying data. It is recommended that all implementation of the User interface follow this security practice as well (many people naively use the same password everywhere, so even if your servlet is not security sensitive you may be exposing your users up to undue risk elsewhere).
You could implement a much better UserProvider and use it instead of this one simply by registering your ResourceProvider as the "user" with the ResourceBroker rather than this one.
For example, you could implement a version of the "user" resource which retreives and saves data to an LDAP server, SQL database, PSE, or other mechanism.
public static final String TYPE
public UserProvider()
public void init(ResourceBroker broker) throws InitException
public final int resourceThreads()
public final int resourceExpireTime()
public final synchronized void resourceRequest(RequestResourceEvent evt)
public final synchronized void resourceCreate(CreateResourceEvent evt) throws ResourceUnavailableException
public final synchronized boolean resourceSave(ResourceEvent evt)
public final synchronized boolean resourceDelete(ResourceEvent evt)
public final synchronized String[] getTypes()
public final synchronized void destroy()
public final String toString()
public static final void main(String arg[])
All Packages Class Hierarchy This Package Previous Next Index