|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.mgmt.EntityImpl
com.antelmann.mgmt.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 |
protected boolean |
active
|
protected String |
description
|
protected String |
name
|
protected String |
passwordHash
|
| Fields inherited from class com.antelmann.mgmt.EntityImpl |
|---|
propertyChangeSupport, props |
| 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)
attention: accessible objects are copied from the given user ONLY if it is a UserImpl instance |
|
| Method Summary | |
|---|---|
Set<Object> |
accessibleObjects()
returns an unmodifiable view over all actions that can be accessed by this user - provided that the canAccess(Object) method is not overridden. |
boolean |
canAccess(Object action)
determines whether this user is allowed to access the given resource |
boolean |
checkPassword(char[] password)
returns true only if the provided password matches the one of this user |
int |
compareTo(User user)
first compares the name, then the id (using a UniversalComparator in both cases) |
boolean |
equals(Object obj)
returns true if the given Object is a User instance and its id is equal |
String |
getDescription()
|
String |
getName()
provides a String used as the login name and also suitable for display; commonly, this would also be returned by toString(). |
String |
getPasswordHash()
returns the password representation suitable for serialization or other permanent storage |
String |
hashPassword(char[] password)
provides the hashing used in this implmenentation (which a subclass may override) |
boolean |
isEnabled()
determines whether this user is currently active |
void |
resetPassword()
|
void |
setAccess(Object action,
boolean flag)
grants/denies access to the given action |
void |
setDescription(String desc)
|
void |
setEnabled(boolean flag)
|
void |
setName(String name)
name must not be null |
void |
setPassword(char[] password)
|
void |
setPasswordHash(String passwordHash)
|
String |
toString()
|
| Methods inherited from class com.antelmann.mgmt.EntityImpl |
|---|
addPropertyChangeListener, checkPropertyChange, containsPropertyText, enableChangeListenerSupport, equalWithProperties, getID, getProperties, getProperty, getPropertyChangeListeners, hashCode, isChangeListenerSupportEnabled, removeProperty, removePropertyChangeListener, setAll, setProperty, verifyProperties |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.antelmann.mgmt.Entity |
|---|
getProperties, getProperty, removeProperty, setProperty |
| Methods inherited from interface com.antelmann.mgmt.Resource |
|---|
getID |
| Field Detail |
|---|
protected String name
protected String passwordHash
protected boolean active
protected String description
protected final HashSet<Object> accessList
canAccess(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)
public UserImpl(Object id,
User user)
| Method Detail |
|---|
public String hashPassword(char[] password)
Strings.hash(String)public boolean checkPassword(char[] password)
User
checkPassword in interface Userpublic void setPassword(char[] password)
setPassword in interface Userpublic void resetPassword()
public String getPasswordHash()
User
getPasswordHash in interface Userpublic void setPasswordHash(String passwordHash)
setPasswordHash in interface Userpublic String getName()
UsertoString().
If the name is used as a login name, it should also be unique, just as well as the id.
getName in interface Userpublic void setName(String name)
public void setEnabled(boolean flag)
public boolean isEnabled()
User
isEnabled in interface Userpublic String getDescription()
getDescription in interface Userpublic void setDescription(String desc)
public String toString()
toString in class Objectpublic int compareTo(User user)
compareTo in interface Comparable<User>Misc.comparatorpublic boolean equals(Object obj)
equals in class EntityImpl
public void setAccess(Object action,
boolean flag)
User
setAccess in interface Userpublic boolean canAccess(Object action)
User
canAccess in interface Userpublic Set<Object> accessibleObjects()
canAccess(Object)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||