public final class DefaultUserProfile extends Object implements UserProfile
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Map<String,Serializable> |
getAttributes()
Returns the attributes associated with this profile as a Map of key/value pairs.
|
Date |
getCreated()
Returns the creation date
|
String |
getEmail()
Returns the user's e-mail address.
|
String |
getFullname()
Returns the user's full name.
|
Date |
getLastModified()
Returns the last-modified date.
|
Date |
getLockExpiry()
Returns the date/time of expiration of the profile's lock, if it has been
previously locked via
UserProfile.setLockExpiry(Date) and the lock is
still active. |
String |
getLoginName()
Returns the user's login name.
|
String |
getPassword()
Returns the user password for use with custom authentication.
|
String |
getUid()
Returns the unique identifier for the user profile.
|
String |
getWikiName()
Returns the user's wiki name.
|
int |
hashCode() |
boolean |
isLocked()
Returns
true if the profile is currently locked (disabled); false otherwise. |
boolean |
isNew()
Returns
true if the user profile is
new. |
protected static UserProfile |
newProfile(UserDatabase db)
Static factory method that creates a new DefaultUserProfile
and sets a unique identifier (uid) for the supplied UserDatabase.
|
void |
setCreated(Date date)
Sets the created date.
|
void |
setEmail(String email)
Sets the user's e-mail address.
|
void |
setFullname(String arg)
Sets the user's full name.
|
void |
setLastModified(Date date)
Sets the last-modified date.
|
void |
setLockExpiry(Date expiry)
Locks the profile until a specified lock expiration date.
|
void |
setLoginName(String name)
Sets the name by which the user logs in.
|
void |
setPassword(String arg)
Sets the user's password for use with custom authentication.
|
void |
setUid(String uid)
Sets the unique identifier for the user profile.
|
String |
toString()
Returns a string representation of this user profile.
|
protected static UserProfile newProfile(UserDatabase db)
db
- the UserDatabase for which the uid should be
createdpublic Date getCreated()
getCreated
in interface UserProfile
UserProfile.getCreated()
public String getEmail()
getEmail
in interface UserProfile
public String getFullname()
getFullname
in interface UserProfile
public Date getLastModified()
getLastModified
in interface UserProfile
UserProfile.getLastModified()
public String getLoginName()
getLoginName
in interface UserProfile
public String getPassword()
UserDatabase
implementation, in most cases the
value returned by this method will be a password hash, not the password
itself.getPassword
in interface UserProfile
public String getWikiName()
getWikiName
in interface UserProfile
public boolean isNew()
true
if the user profile is
new. This implementation checks whether
getLastModified()
returns null
to determine the status.isNew
in interface UserProfile
UserProfile.isNew()
public void setCreated(Date date)
UserProfile
setCreated
in interface UserProfile
date
- the creation dateUserProfile.setCreated(java.util.Date)
public void setEmail(String email)
setEmail
in interface UserProfile
email
- the e-mail addresspublic void setFullname(String arg)
setFullname
in interface UserProfile
arg
- the full namepublic void setLastModified(Date date)
setLastModified
in interface UserProfile
date
- the last-modified dateUserProfile.setLastModified(java.util.Date)
public void setLoginName(String name)
AuthenticationManager.login(WikiSession,HttpServletRequest, String, String)
).
The login name is typically a short name ("jannej"). In contrast, the
wiki name is typically of type FirstnameLastName ("JanneJalkanen").setLoginName
in interface UserProfile
name
- the login namepublic void setPassword(String arg)
UserDatabase.save(UserProfile)
).
Note that the password field is not meaningful for container
authentication; the user's private credentials are generally stored
elsewhere.setPassword
in interface UserProfile
arg
- the passwordpublic String toString()
toString
in interface UserProfile
toString
in class Object
public Map<String,Serializable> getAttributes()
getAttributes
in interface UserProfile
public Date getLockExpiry()
UserProfile.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 UserProfile.setLockExpiry(Date)
, will always return
null.
getLockExpiry
in interface UserProfile
public String getUid()
null
.getUid
in interface UserProfile
public boolean isLocked()
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 UserProfile.getLockExpiry()
and, if it returns a non-null
value, checking if the date returned is later than the current time.isLocked
in interface UserProfile
public void setLockExpiry(Date expiry)
setLockExpiry
in interface UserProfile
expiry
- the date the lock expires; setting this value to null
will cause the lock to be cleared.public void setUid(String uid)
setUid
in interface UserProfile
uid
- the unique identifier to setCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.