public abstract class UserProfile extends Object implements Serializable, Externalizable
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
static String |
SEPARATOR |
| Modifier | Constructor and Description |
|---|---|
protected |
UserProfile() |
protected |
UserProfile(boolean canAttributesBeMerged)
Create a profile with possibility to merge attributes with the same name and collection-type values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String key,
Object value)
Add an attribute.
|
void |
addAttributes(Map<String,Object> attributes)
Add attributes.
|
void |
addAuthenticationAttribute(String key,
Object value)
Add an authentication-related attribute
|
void |
addAuthenticationAttributes(Map<String,Object> attributeMap)
Add authentication attributes.
|
void |
addPermission(String permission)
Add a permission.
|
void |
addPermissions(Collection<String> permissions)
Add permissions.
|
void |
addRole(String role)
Add a role.
|
void |
addRoles(Collection<String> roles)
Add roles.
|
void |
addRoles(Set<String> roles)
Add roles.
|
void |
build(Object id,
Map<String,Object> attributes)
Build a profile from user identifier and attributes.
|
void |
build(Object id,
Map<String,Object> attributes,
Map<String,Object> authenticationAttributes)
Build a profile from user identifier, attributes, and authentication attributes.
|
void |
clearSensitiveData() |
boolean |
containsAttribute(String name)
Check to see if profile contains attribute name.
|
boolean |
containsAuthenicationAttribute(String name)
Check to see if profile contains attribute name.
|
Object |
getAttribute(String name)
Return the attribute with name.
|
<T> T |
getAttribute(String name,
Class<T> clazz)
Return the attribute with name.
|
Map<String,Object> |
getAttributes()
Get all attributes as immutable map.
|
Object |
getAuthenticationAttribute(String name)
Return the authentication attribute with name.
|
<T> T |
getAuthenticationAttribute(String name,
Class<T> clazz)
Return authentication attribute with name
|
Map<String,Object> |
getAuthenticationAttributes()
Get all authentication attributes as an immutable map
|
String |
getClientName() |
String |
getId()
Get the user identifier.
|
String |
getLinkedId() |
Set<String> |
getPermissions()
Get the permissions of the user.
|
Set<String> |
getRoles()
Get the roles of the user.
|
String |
getTypedId()
Get the user identifier with a prefix which is the profile type (full class name with package).
|
boolean |
isRemembered()
Is the user remembered?
|
void |
readExternal(ObjectInput in) |
void |
removeAttribute(String key)
Remove an attribute by its key.
|
void |
removeAuthenticationAttribute(String key)
Remove an authentication attribute by its key
|
void |
setClientName(String clientName) |
void |
setId(String id)
Set the identifier.
|
void |
setLinkedId(String linkedId) |
void |
setPermissions(Set<String> permissions) |
void |
setRemembered(boolean rme)
Define if this profile is remembered.
|
void |
setRoles(Set<String> roles) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected final transient org.slf4j.Logger logger
public static final transient String SEPARATOR
protected UserProfile()
protected UserProfile(boolean canAttributesBeMerged)
canAttributesBeMerged - if true - merge attributes with the same name and collection-type values, if false - overwrite thempublic void build(Object id, Map<String,Object> attributes)
id - user identifierattributes - user attributespublic void build(Object id, Map<String,Object> attributes, Map<String,Object> authenticationAttributes)
id - user identifierattributes - user attributesauthenticationAttributes - authentication attributespublic void addAttribute(String key, Object value)
key - key of the attributevalue - value of the attributepublic void addAuthenticationAttribute(String key, Object value)
key - the attribute keyvalue - the attribute valuepublic void addAttributes(Map<String,Object> attributes)
attributes - use attributespublic void addAuthenticationAttributes(Map<String,Object> attributeMap)
attributeMap - the authentication attributespublic void removeAttribute(String key)
key - the keypublic void removeAuthenticationAttribute(String key)
key - the keypublic void setId(String id)
id - user identifierpublic String getId()
public String getTypedId()
public Map<String,Object> getAttributes()
public Map<String,Object> getAuthenticationAttributes()
public Object getAttribute(String name)
name - attribute namepublic Object getAuthenticationAttribute(String name)
name - authentication attribute namepublic boolean containsAttribute(String name)
name - the namepublic boolean containsAuthenicationAttribute(String name)
name - the namepublic <T> T getAttribute(String name, Class<T> clazz)
T - the type of the attributename - the attribute nameclazz - the class of the attributepublic <T> T getAuthenticationAttribute(String name, Class<T> clazz)
T - The type of the authentication attributename - Name of authentication attributeclazz - The class of the authentication attributepublic void addRole(String role)
role - the role to add.public void addRoles(Collection<String> roles)
roles - the roles to add.public void addPermission(String permission)
permission - the permission to add.public void addPermissions(Collection<String> permissions)
permissions - the permissions to add.public void setRemembered(boolean rme)
rme - whether the user is remembered.public Set<String> getPermissions()
public boolean isRemembered()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void clearSensitiveData()
public String getClientName()
public void setClientName(String clientName)
public String getLinkedId()
public void setLinkedId(String linkedId)
Copyright © 2019. All rights reserved.