public class UserDetails extends java.lang.Object implements AuthenticationResponse
Constructor and Description |
---|
UserDetails(java.lang.String username,
java.util.Collection<java.lang.String> roles) |
UserDetails(java.lang.String username,
java.util.Collection<java.lang.String> roles,
java.util.Map<java.lang.String,java.lang.Object> attributes) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes(java.lang.String rolesKey,
java.lang.String usernameKey) |
java.util.Optional<java.lang.String> |
getMessage() |
java.util.Collection<java.lang.String> |
getRoles()
roles getter.
|
java.util.Optional<UserDetails> |
getUserDetails() |
java.lang.String |
getUsername()
username getter.
|
int |
hashCode() |
void |
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets user's attributes.
|
void |
setRoles(java.util.Collection<java.lang.String> roles)
roles setter.
|
void |
setUsername(java.lang.String username)
username setter.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isAuthenticated
public UserDetails(java.lang.String username, java.util.Collection<java.lang.String> roles)
username
- e.g. adminroles
- e.g. ['ROLE_ADMIN', 'ROLE_USER']public UserDetails(java.lang.String username, java.util.Collection<java.lang.String> roles, java.util.Map<java.lang.String,java.lang.Object> attributes)
username
- e.g. adminroles
- e.g. ['ROLE_ADMIN', 'ROLE_USER']attributes
- User's attributespublic java.util.Map<java.lang.String,java.lang.Object> getAttributes(java.lang.String rolesKey, java.lang.String usernameKey)
rolesKey
- the key for the roles attributeusernameKey
- the key for the username attributepublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- e.g. adminpublic java.util.Collection<java.lang.String> getRoles()
public void setRoles(java.util.Collection<java.lang.String> roles)
roles
- e.g. ['ROLE_USER', 'ROLE_ADMIN']public void setAttributes(@Nullable java.util.Map<java.lang.String,java.lang.Object> attributes)
attributes
- User's attributes.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.Optional<UserDetails> getUserDetails()
getUserDetails
in interface AuthenticationResponse
public java.util.Optional<java.lang.String> getMessage()
getMessage
in interface AuthenticationResponse