Interface UserProfile

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DefaultUserProfile

public interface UserProfile
extends java.io.Serializable
Class for representing wiki user information, such as the login name, full name, wiki name, and e-mail address. Note that since 2.6 the wiki name is required to be automatically computed from the full name. As of 2.8, user profiles can store custom key/value String/Serializable attributes, and store a unique ID. Locks are checked by AuthenticationManager; if a profile is locked, the user cannot log with that profile.
Since:
2.3
  • Method Summary

    Modifier and Type Method Description
    java.util.Map<java.lang.String,​java.io.Serializable> getAttributes()
    Returns the attributes associated with this profile as a Map of key/value pairs.
    java.util.Date getCreated()
    Returns the creation date.
    java.lang.String getEmail()
    Returns the user's e-mail address.
    java.lang.String getFullname()
    Returns the user's full name.
    java.util.Date getLastModified()
    Returns the last-modified date.
    java.util.Date getLockExpiry()
    Returns the date/time of expiration of the profile's lock, if it has been previously locked via setLockExpiry(Date) and the lock is still active.
    java.lang.String getLoginName()
    Returns the user's login name.
    java.lang.String getPassword()
    Returns the user password for use with custom authentication.
    java.lang.String getUid()
    Returns the unique identifier for the user profile.
    java.lang.String getWikiName()
    Returns the user's wiki name, based on the full name with all whitespace removed.
    boolean isLocked()
    Returns true if the profile is currently locked (disabled); false otherwise.
    boolean isNew()
    Returns true if the profile has never been saved before.
    void setCreated​(java.util.Date date)
    Sets the created date.
    void setEmail​(java.lang.String email)
    Sets the user's e-mail address.
    void setFullname​(java.lang.String arg)
    Sets the user's full name.
    void setLastModified​(java.util.Date date)
    Sets the last-modified date
    void setLockExpiry​(java.util.Date expiry)
    Locks the profile until a specified lock expiration date.
    void setLoginName​(java.lang.String name)
    Sets the name by which the user logs in.
    void setPassword​(java.lang.String arg)
    Sets the user's password for use with custom authentication.
    void setUid​(java.lang.String uid)
    Sets the unique identifier for the user profile.
    java.lang.String toString()
    Returns a string representation of this user profile.
  • Method Details

    • getAttributes

      java.util.Map<java.lang.String,​java.io.Serializable> getAttributes()
      Returns the attributes associated with this profile as a Map of key/value pairs. The Map should generally be a "live" Map; changes to the keys or values will be reflected in the UserProfile.
      Returns:
      the attributes
    • getCreated

      java.util.Date getCreated()
      Returns the creation date.
      Returns:
      the creation date
    • getEmail

      java.lang.String getEmail()
      Returns the user's e-mail address.
      Returns:
      the e-mail address
    • getFullname

      java.lang.String getFullname()
      Returns the user's full name.
      Returns:
      the full name
    • getLastModified

      java.util.Date getLastModified()
      Returns the last-modified date.
      Returns:
      the date and time of last modification
    • getLockExpiry

      java.util.Date getLockExpiry()
      Returns the date/time of expiration of the profile's lock, if it has been previously locked via setLockExpiry(Date) and the lock is still active. If the profile is unlocked, this method returns null. Note that calling this method after the expiration date, even if had previously been set explicitly by setLockExpiry(Date), will always return null.
      Returns:
      the lock expiration date
    • getLoginName

      java.lang.String getLoginName()
      Returns the user's login name.
      Returns:
      the login name
    • getPassword

      java.lang.String getPassword()
      Returns the user password for use with custom authentication. Note that the password field is not meaningful for container authentication; the user's private credentials are generally stored elsewhere. While it depends on the UserDatabaseimplementation, in most cases the value returned by this method will be a password hash, not the password itself.
      Returns:
      the password
    • getUid

      java.lang.String getUid()
      Returns the unique identifier for the user profile. If not previously set, the value will be null.
      Returns:
      the unique ID.
    • getWikiName

      java.lang.String getWikiName()
      Returns the user's wiki name, based on the full name with all whitespace removed.
      Returns:
      the wiki name.
    • isLocked

      boolean isLocked()
      Returns true if the profile is currently locked (disabled); false otherwise. By default, profiles are created unlocked. Strictly speaking, calling this method is equivalent to calling getLockExpiry() and, if it returns a non-null value, checking if the date returned is later than the current time.
      Returns:
      the result
    • isNew

      boolean isNew()
      Returns true if the profile has never been saved before. Implementing classes might check the last modified date, for example, to determine this.
      Returns:
      whether the profile is new
    • setCreated

      void setCreated​(java.util.Date date)
      Sets the created date.
      Parameters:
      date - the creation date
    • setEmail

      void setEmail​(java.lang.String email)
      Sets the user's e-mail address.
      Parameters:
      email - the e-mail address
    • setFullname

      void setFullname​(java.lang.String arg)
      Sets the user's full name. For example, "Janne Jalkanen."
      Parameters:
      arg - the full name
    • setLastModified

      void setLastModified​(java.util.Date date)
      Sets the last-modified date
      Parameters:
      date - the last-modified date
    • setLockExpiry

      void setLockExpiry​(java.util.Date expiry)
      Locks the profile until a specified lock expiration date.
      Parameters:
      expiry - the date the lock expires; setting this value to null will cause the lock to be cleared.
    • setLoginName

      void setLoginName​(java.lang.String name)
      Sets the name by which the user logs in. The login name is used as the username for custom authentication (see AuthenticationManager.login(org.apache.wiki.api.core.Session, javax.servlet.http.HttpServletRequest, String, String), UserDatabaseLoginModule). The login name is typically a short name ("jannej"). In contrast, the wiki name is typically of type FirstnameLastName ("JanneJalkanen").
      Parameters:
      name - the login name
    • setPassword

      void setPassword​(java.lang.String arg)
      Sets the user's password for use with custom authentication. It is not the responsibility of implementing classes to hash the password; that responsibility is borne by the UserDatabase implementation during save operations (see UserDatabase.save(UserProfile)). Note that the password field is not meaningful for container authentication; the user's private credentials are generally stored elsewhere.
      Parameters:
      arg - the password
    • setUid

      void setUid​(java.lang.String uid)
      Sets the unique identifier for the user profile. Note that UserDatabase implementations are required not to change the unique identifier after the initial save.
      Parameters:
      uid - the unique identifier to set
    • toString

      java.lang.String toString()
      Returns a string representation of this user profile.
      Overrides:
      toString in class java.lang.Object
      Returns:
      the string