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