Class XMLUserDatabase

java.lang.Object
org.apache.wiki.auth.user.AbstractUserDatabase
org.apache.wiki.auth.user.XMLUserDatabase
All Implemented Interfaces:
UserDatabase

public class XMLUserDatabase
extends AbstractUserDatabase

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.

Since:
2.3
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String PROP_USERDATABASE
    The jspwiki.properties property specifying the file system location of the user database.

    Fields inherited from class org.apache.wiki.auth.user.AbstractUserDatabase

    log, SHA_PREFIX, SSHA_PREFIX
  • Constructor Summary

    Constructors
    Constructor Description
    XMLUserDatabase()  
  • Method Summary

    Modifier and Type Method Description
    void deleteByLoginName​(java.lang.String loginName)
    Looks up and deletes the first UserProfile in the user database that matches a profile having a given login name.
    UserProfile findBy​(java.lang.String attr, java.lang.String value)  
    UserProfile findByEmail​(java.lang.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​(java.lang.String index)
    Looks up and returns the first UserProfile in the user database that matches a profile having a given full name.
    UserProfile findByLoginName​(java.lang.String index)
    Looks up and returns the first UserProfile in the user database that matches a profile having a given login name.
    UserProfile findByUid​(java.lang.String uid)
    Looks up and returns the first UserProfile in the user database that matches a profile having a given unique ID (uid).
    UserProfile findByWikiName​(java.lang.String index)
    Looks up and returns the first UserProfile in the user database that matches a profile having a given wiki name.
    java.security.Principal[] getWikiNames()
    Returns all WikiNames that are stored in the UserDatabase as an array of Principal objects.
    void initialize​(Engine engine, java.util.Properties props)
    Initializes the user database based on values from a Properties object.
    void rename​(java.lang.String loginName, java.lang.String newName)
    Renames a UserProfile in the user database by changing the profile's login name.
    void save​(UserProfile profile)
    Saves a UserProfileto the user database, overwriting the existing profile if it exists.

    Methods inherited from class org.apache.wiki.auth.user.AbstractUserDatabase

    find, generateUid, getHash, getPrincipals, newProfile, parseLong, validatePassword

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait