public abstract class UserProfile extends Object implements Serializable, Externalizable
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
static String |
SEPARATOR |
Constructor and Description |
---|
UserProfile() |
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(Object id)
Set the identifier and convert it if necessary.
|
void |
setLinkedId(String linkedId) |
void |
setRemembered(boolean rme)
Define if this profile is remembered.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected final transient org.slf4j.Logger logger
public static final transient String SEPARATOR
public 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
- value
- public 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(Object 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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void clearSensitiveData()
public String getClientName()
public void setClientName(String clientName)
public String getLinkedId()
public void setLinkedId(String linkedId)
Copyright © 2018. All rights reserved.