Package org.apache.wiki.auth.user
Class DefaultUserProfile
- java.lang.Object
-
- org.apache.wiki.auth.user.DefaultUserProfile
-
- All Implemented Interfaces:
java.io.Serializable,UserProfile
public final class DefaultUserProfile extends java.lang.Object implements UserProfile
Default implementation for representing wiki user information, such as the login name, full name, wiki name, and e-mail address.- Since:
- 2.3
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)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.DategetCreated()Returns the creation datejava.lang.StringgetEmail()Returns the user's e-mail address.java.lang.StringgetFullname()Returns the user's full name.java.util.DategetLastModified()Returns the last-modified date.java.util.DategetLockExpiry()Returns the date/time of expiration of the profile's lock, if it has been previously locked viaUserProfile.setLockExpiry(Date)and the lock is still active.java.lang.StringgetLoginName()Returns the user's login name.java.lang.StringgetPassword()Returns the user password for use with custom authentication.java.lang.StringgetUid()Returns the unique identifier for the user profile.java.lang.StringgetWikiName()Returns the user's wiki name.inthashCode()booleanisLocked()Returnstrueif the profile is currently locked (disabled);falseotherwise.booleanisNew()Returnstrueif the user profile is new.voidsetCreated(java.util.Date date)Sets the created date.voidsetEmail(java.lang.String email)Sets the user's e-mail address.voidsetFullname(java.lang.String arg)Sets the user's full name.voidsetLastModified(java.util.Date date)Sets the last-modified date.voidsetLockExpiry(java.util.Date expiry)Locks the profile until a specified lock expiration date.voidsetLoginName(java.lang.String name)Sets the name by which the user logs in.voidsetPassword(java.lang.String arg)Sets the user's password for use with custom authentication.voidsetUid(java.lang.String uid)Sets the unique identifier for the user profile.java.lang.StringtoString()Returns a string representation of this user profile.
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getCreated
public java.util.Date getCreated()
Returns the creation date- Specified by:
getCreatedin interfaceUserProfile- Returns:
- the creation date
- See Also:
UserProfile.getCreated()
-
getEmail
public java.lang.String getEmail()
Returns the user's e-mail address.- Specified by:
getEmailin interfaceUserProfile- Returns:
- the e-mail address
-
getFullname
public java.lang.String getFullname()
Returns the user's full name.- Specified by:
getFullnamein interfaceUserProfile- Returns:
- the full name
-
getLastModified
public java.util.Date getLastModified()
Returns the last-modified date.- Specified by:
getLastModifiedin interfaceUserProfile- Returns:
- the last-modified date
- See Also:
UserProfile.getLastModified()
-
getLoginName
public java.lang.String getLoginName()
Returns the user's login name.- Specified by:
getLoginNamein interfaceUserProfile- Returns:
- the login name
-
getPassword
public 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 theUserDatabaseimplementation, in most cases the value returned by this method will be a password hash, not the password itself.- Specified by:
getPasswordin interfaceUserProfile- Returns:
- the password
-
getWikiName
public java.lang.String getWikiName()
Returns the user's wiki name.- Specified by:
getWikiNamein interfaceUserProfile- Returns:
- the wiki name.
-
isNew
public boolean isNew()
Returnstrueif the user profile is new. This implementation checks whethergetLastModified()returnsnullto determine the status.- Specified by:
isNewin interfaceUserProfile- Returns:
- whether the profile is new
- See Also:
UserProfile.isNew()
-
setCreated
public void setCreated(java.util.Date date)
Description copied from interface:UserProfileSets the created date.- Specified by:
setCreatedin interfaceUserProfile- Parameters:
date- the creation date- See Also:
UserProfile.setCreated(java.util.Date)
-
setEmail
public void setEmail(java.lang.String email)
Sets the user's e-mail address.- Specified by:
setEmailin interfaceUserProfile- Parameters:
email- the e-mail address
-
setFullname
public void setFullname(java.lang.String arg)
Sets the user's full name. For example, "Janne Jalkanen."- Specified by:
setFullnamein interfaceUserProfile- Parameters:
arg- the full name
-
setLastModified
public void setLastModified(java.util.Date date)
Sets the last-modified date.- Specified by:
setLastModifiedin interfaceUserProfile- Parameters:
date- the last-modified date- See Also:
UserProfile.setLastModified(java.util.Date)
-
setLoginName
public 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 (seeAuthenticationManager.login(org.apache.wiki.api.core.Session,HttpServletRequest, String, String)). The login name is typically a short name ("jannej"). In contrast, the wiki name is typically of type FirstnameLastName ("JanneJalkanen").- Specified by:
setLoginNamein interfaceUserProfile- Parameters:
name- the login name
-
setPassword
public 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 (seeUserDatabase.save(UserProfile)). Note that the password field is not meaningful for container authentication; the user's private credentials are generally stored elsewhere.- Specified by:
setPasswordin interfaceUserProfile- Parameters:
arg- the password
-
toString
public java.lang.String toString()
Returns a string representation of this user profile.- Specified by:
toStringin interfaceUserProfile- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-
getAttributes
public 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.- Specified by:
getAttributesin interfaceUserProfile- Returns:
- the attributes
-
getLockExpiry
public java.util.Date getLockExpiry()
Returns the date/time of expiration of the profile's lock, if it has been previously locked viaUserProfile.setLockExpiry(Date)and the lock is still active. If the profile is unlocked, this method returnsnull. Note that calling this method after the expiration date, even if had previously been set explicitly byUserProfile.setLockExpiry(Date), will always returnnull.- Specified by:
getLockExpiryin interfaceUserProfile- Returns:
- the lock expiration date
-
getUid
public java.lang.String getUid()
Returns the unique identifier for the user profile. If not previously set, the value will benull.- Specified by:
getUidin interfaceUserProfile- Returns:
- the unique ID.
-
isLocked
public boolean isLocked()
Returnstrueif the profile is currently locked (disabled);falseotherwise. By default, profiles are created unlocked. Strictly speaking, calling this method is equivalent to callingUserProfile.getLockExpiry()and, if it returns a non-nullvalue, checking if the date returned is later than the current time.- Specified by:
isLockedin interfaceUserProfile- Returns:
- the result
-
setLockExpiry
public void setLockExpiry(java.util.Date expiry)
Locks the profile until a specified lock expiration date.- Specified by:
setLockExpiryin interfaceUserProfile- Parameters:
expiry- the date the lock expires; setting this value tonullwill cause the lock to be cleared.
-
setUid
public 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.- Specified by:
setUidin interfaceUserProfile- Parameters:
uid- the unique identifier to set
-
-