Class AbstractUserDatabase

java.lang.Object
org.apache.wiki.auth.user.AbstractUserDatabase
All Implemented Interfaces:
UserDatabase
Direct Known Subclasses:
DummyUserDatabase, JDBCUserDatabase, XMLUserDatabase

public abstract class AbstractUserDatabase
extends java.lang.Object
implements UserDatabase
Abstract UserDatabase class that provides convenience methods for finding profiles, building Principal collections and hashing passwords.
Since:
2.3
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected static org.apache.log4j.Logger log  
    protected static java.lang.String SHA_PREFIX  
    protected static java.lang.String SSHA_PREFIX  
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractUserDatabase()  
  • Method Summary

    Modifier and Type Method Description
    UserProfile find​(java.lang.String index)
    Looks up and returns the first UserProfile in the user database that whose login name, full name, or wiki name matches the supplied string.
    abstract 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.
    abstract 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.
    abstract 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.
    abstract 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.
    protected static java.lang.String generateUid​(UserDatabase db)
    Generates a new random user identifier (uid) that is guaranteed to be unique.
    protected java.lang.String getHash​(java.lang.String text)
    Private method that calculates the salted SHA-1 hash of a given String.
    java.security.Principal[] getPrincipals​(java.lang.String identifier)
    Looks up the Principals representing a user from the user database.
    abstract void initialize​(Engine engine, java.util.Properties props)
    Initializes the user database based on values from a Properties object.
    UserProfile newProfile()
    Factory method that instantiates a new DefaultUserProfile with a new, distinct unique identifier.
    protected long parseLong​(java.lang.String value)
    Parses a long integer from a supplied string, or returns 0 if not parsable.
    abstract void save​(UserProfile profile)
    Saves a UserProfileto the user database, overwriting the existing profile if it exists.
    boolean validatePassword​(java.lang.String loginName, java.lang.String password)
    Validates the password for a given user.

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.wiki.auth.user.UserDatabase

    deleteByLoginName, findByUid, getWikiNames, rename