|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.AbstractDBEntry
com.antelmann.db.PropertyEntryImpl
com.antelmann.db.UserImpl
public class UserImpl
This class represents a default User implementation that can serve as the basis for more specific implementations. The password is stored as a hash value.
Strings.hash(String),
Serialized Form| Field Summary | |
|---|---|
protected HashSet<Object> |
accessList
used to store actions that can be accessed |
| Fields inherited from class com.antelmann.db.PropertyEntryImpl |
|---|
propertyChangeSupport, props, um, vcs |
| Fields inherited from interface com.antelmann.db.DBEntry |
|---|
ENTRY_FLAVOR, ENTRY_LIST_FLAVOR |
| Fields inherited from interface com.antelmann.util.Enabled |
|---|
FILTER |
| Constructor Summary | |
|---|---|
UserImpl(Object idAndName)
|
|
UserImpl(Object id,
String name)
|
|
UserImpl(Object id,
String name,
String passwordHash,
boolean active)
|
|
UserImpl(Object id,
String name,
String passwordHash,
boolean enabled,
String description)
|
|
UserImpl(Object id,
User user)
|
|
| Method Summary | |
|---|---|
boolean |
checkPassword(char[] password)
returns true only if the provided password matches the one of this user |
void |
clearAllAccess()
|
int |
compareTo(User user)
first compares the name, then the id (using a UniversalComparator in both cases) |
void |
copyAccessRightsFrom(UserImpl user)
copies all accessible objects from the given user into this user and removes all accessible objects that are not accessible by that user. |
boolean |
equals(Object obj)
returns true if the given Object is some User instance and its id is equal |
Filter<Object> |
getAccessFilter()
|
Set<Object> |
getAccessibleObjects()
returns an unmodifiable view over all actions that can be accessed by this user - provided that the hasAccess(Object) method is not overridden. |
String |
getEmail()
|
String |
getName()
|
String |
getPasswordHash()
returns the password representation suitable for serialization or other permanent storage |
String |
getUserDescription()
|
boolean |
hasAccess(Object action)
determines whether this user is allowed to access the given resource |
protected String |
hashPassword(char[] password)
provides the hashing used in this implementation (which a subclass may override) |
boolean |
isEnabled()
determines whether this object is currently enabled |
void |
resetPassword()
sets the password to null |
void |
setAccess(Object action,
boolean flag)
grants/denies access to the given action |
void |
setAccessFilter(Filter<Object> accessFilter)
allows to customize the way hasAccess(Object) works. |
void |
setEmail(String email)
|
void |
setEnabled(boolean flag)
allows to enable/disable this instance |
void |
setName(String name)
name must not be null |
void |
setPassword(char[] password)
sets the password for this user (the password itself is not stored, but a hashed version of it) |
void |
setPasswordHash(String passwordHash)
directly sets the hashed version of the password (so that the password can be changed to that of another user without knowing it) |
void |
setUserDescription(String desc)
|
String |
toString()
|
| Methods inherited from class com.antelmann.db.AbstractDBEntry |
|---|
getID, hashCode, hashEntry, sameEntry |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.antelmann.db.DBEntry |
|---|
getID |
| Methods inherited from interface java.security.Principal |
|---|
hashCode |
| Field Detail |
|---|
protected final HashSet<Object> accessList
hasAccess(Object)| Constructor Detail |
|---|
public UserImpl(Object idAndName)
public UserImpl(Object id,
String name)
public UserImpl(Object id,
String name,
String passwordHash,
boolean active)
public UserImpl(Object id,
String name,
String passwordHash,
boolean enabled,
String description)
@Warning(value="accessible Objects are not copied if it is not a UserImpl and properties are only copied if it is a PropertyEntry")
public UserImpl(Object id,
User user)
| Method Detail |
|---|
protected String hashPassword(char[] password)
Strings.hash(String),
SecureUserImplpublic boolean checkPassword(char[] password)
User
checkPassword in interface User
public void setPassword(char[] password)
throws IllegalArgumentException
User
setPassword in interface UserIllegalArgumentException
public void resetPassword()
throws IllegalArgumentException
resetPassword in interface UserIllegalArgumentExceptionpublic String getPasswordHash()
User
getPasswordHash in interface Userpublic void setPasswordHash(String passwordHash)
User
setPasswordHash in interface Userpublic String getName()
getName in interface Principalpublic void setName(String name)
setName in interface Userpublic void setEnabled(boolean flag)
Enabled
setEnabled in interface Enabledpublic boolean isEnabled()
Enabled
isEnabled in interface Enabledpublic String getUserDescription()
getUserDescription in interface Userpublic void setUserDescription(String desc)
setUserDescription in interface Userpublic String getEmail()
getEmail in interface Userpublic void setEmail(String email)
setEmail in interface Userpublic String toString()
toString in interface PrincipaltoString in class AbstractDBEntrypublic int compareTo(User user)
compareTo in interface Comparable<User>UniversalComparatorpublic boolean equals(Object obj)
equals in interface Principalequals in class AbstractDBEntry
public void setAccess(Object action,
boolean flag)
User
setAccess in interface Userpublic Filter<Object> getAccessFilter()
public void setAccessFilter(Filter<Object> accessFilter)
hasAccess(Object) works.
if a non-null value is set, this filter supersedes the logic
of hasAccess(Object) via the accessList.
If a subclass uses this concept, it also has to take care of
the implications for UserImpl(Object, User) and clearAllAccess().
hasAccess(Object)public boolean hasAccess(Object action)
User
hasAccess in interface Userpublic void clearAllAccess()
public Set<Object> getAccessibleObjects()
hasAccess(Object)public void copyAccessRightsFrom(UserImpl user)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||