|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.auth.user.AbstractUserDatabase
com.ecyrd.jspwiki.auth.user.XMLUserDatabase
public class XMLUserDatabase
Manages DefaultUserProfile
objects using XML files for persistence.
Passwords are hashed using SHA1. User entries are simple <user>
elements under the root. User profile properties are attributes of the
element. For example:
<users>
<user loginName="janne" fullName="Janne Jalkanen"
wikiName="JanneJalkanen" email="janne@ecyrd.com"
password="{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee"/>
</users>
In this example, the un-hashed password is myP@5sw0rd
. Passwords are hashed without salt.
Field Summary | |
---|---|
static String |
PROP_USERDATABASE
The jspwiki.properties property specifying the file system location of the user database. |
Fields inherited from class com.ecyrd.jspwiki.auth.user.AbstractUserDatabase |
---|
log, PROP_SHARED_WITH_CONTAINER, SHA_PREFIX |
Constructor Summary | |
---|---|
XMLUserDatabase()
|
Method Summary | |
---|---|
void |
commit()
Persists database changes to disk. |
void |
deleteByLoginName(String loginName)
Looks up and deletes the first UserProfile in the user database
that matches a profile having a given login name. |
UserProfile |
findByEmail(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given e-mail address. |
UserProfile |
findByFullName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given full name. |
UserProfile |
findByLoginName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given login name. |
UserProfile |
findByWikiName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given wiki name. |
Principal[] |
getWikiNames()
Returns all WikiNames that are stored in the UserDatabase as an array of WikiPrincipal objects. |
void |
initialize(WikiEngine engine,
Properties props)
Initializes the user database based on values from a Properties object. |
boolean |
isSharedWithContainer()
Determines whether the user database shares user/password data with the web container; always returns false . |
void |
save(UserProfile profile)
Saves a UserProfile to the user database, overwriting the
existing profile if it exists. |
Methods inherited from class com.ecyrd.jspwiki.auth.user.AbstractUserDatabase |
---|
find, getHash, getPrincipals, newProfile, validatePassword |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_USERDATABASE
Constructor Detail |
---|
public XMLUserDatabase()
Method Detail |
---|
public void commit() throws WikiSecurityException
commit
in interface UserDatabase
commit
in class AbstractUserDatabase
WikiSecurityException
UserDatabase.commit()
public void deleteByLoginName(String loginName) throws NoSuchPrincipalException, WikiSecurityException
UserProfile
in the user database
that matches a profile having a given login name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
. The method does not commit the
results of the delete; it only alters the database in memory.
loginName
- the login name of the user profile that shall be deleted
NoSuchPrincipalException
WikiSecurityException
public UserProfile findByEmail(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given e-mail address. If the user
database does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
findByEmail
in interface UserDatabase
findByEmail
in class AbstractUserDatabase
index
- the e-mail address of the desired user profile
NoSuchPrincipalException
UserDatabase.findByEmail(String)
public UserProfile findByFullName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given full name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
findByFullName
in interface UserDatabase
findByFullName
in class AbstractUserDatabase
index
- the fill name of the desired user profile
NoSuchPrincipalException
UserDatabase.findByFullName(java.lang.String)
public UserProfile findByLoginName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given login name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
findByLoginName
in interface UserDatabase
findByLoginName
in class AbstractUserDatabase
index
- the login name of the desired user profile
NoSuchPrincipalException
UserDatabase.findByLoginName(java.lang.String)
public UserProfile findByWikiName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given wiki name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
findByWikiName
in interface UserDatabase
findByWikiName
in class AbstractUserDatabase
index
- the wiki name of the desired user profile
NoSuchPrincipalException
UserDatabase.findByWikiName(java.lang.String)
public Principal[] getWikiNames() throws WikiSecurityException
WikiSecurityException
public void initialize(WikiEngine engine, Properties props) throws NoRequiredPropertyException
PROP_USERDATABASE
.
initialize
in interface UserDatabase
initialize
in class AbstractUserDatabase
NoRequiredPropertyException
- if the user database cannot be located, parsed, or openedUserDatabase.initialize(com.ecyrd.jspwiki.WikiEngine,
java.util.Properties)
public boolean isSharedWithContainer()
false
.
UserDatabase.isSharedWithContainer()
public void save(UserProfile profile) throws WikiSecurityException
UserProfile
to the user database, overwriting the
existing profile if it exists. The user name under which the profile
should be saved is returned by the supplied profile's
UserProfile.getLoginName()
method.
save
in interface UserDatabase
save
in class AbstractUserDatabase
profile
- the user profile to save
WikiSecurityException
- if the profile cannot be savedUserDatabase.save(com.ecyrd.jspwiki.auth.user.UserProfile)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |