Package org.openhab.core.auth
Class ManagedUser
java.lang.Object
org.openhab.core.auth.ManagedUser
- All Implemented Interfaces:
Principal
,User
,Identifiable<String>
A
User
sourced from a managed UserProvider
.- Author:
- Yannick Schaus - initial contribution
-
Constructor Summary
ConstructorDescriptionManagedUser
(String name, String passwordSalt, String passwordHash) Constructs a user with a password hash and salt provided by the caller. -
Method Summary
Modifier and TypeMethodDescriptionGets the long-term API tokens for this usergetName()
Gets the password hash.Gets the password salt.@Nullable PendingToken
Gets the pending token information for this user, if any.getRoles()
Gets the roles attributed to the user.Gets the current persistent sessions for this user.getUID()
Get the unique identifier.void
setApiTokens
(List<UserApiToken> apiTokens) Replaces the list of API tokens by a new one.void
Alters the user's account namevoid
setPasswordHash
(String passwordHash) Alters the password hash.void
setPasswordSalt
(String passwordSalt) Alters the password salt.void
setPendingToken
(@Nullable PendingToken pendingToken) Sets or clears the pending token information for this user.void
Alters the user's set of roles.void
setSessions
(List<UserSession> sessions) Replaces the list of sessions by a new one.toString()
-
Constructor Details
-
ManagedUser
Constructs a user with a password hash and salt provided by the caller.- Parameters:
name
- the username (account name)passwordSalt
- the salt to compute the password hashpasswordHash
- the result of the hashing of the salted password
-
-
Method Details
-
getPasswordHash
Gets the password hash.- Returns:
- the password hash
-
setPasswordSalt
Alters the password salt.- Parameters:
passwordSalt
- the new password salt
-
setPasswordHash
Alters the password hash.- Parameters:
passwordHash
- the new password hash
-
getPasswordSalt
Gets the password salt.- Returns:
- the password salt
-
getName
-
setName
Alters the user's account name- Parameters:
name
- the new account name
-
getUID
Description copied from interface:Identifiable
Get the unique identifier.- Specified by:
getUID
in interfaceIdentifiable<String>
- Returns:
- the unique identifier
-
getRoles
Description copied from interface:User
Gets the roles attributed to the user. -
setRoles
Alters the user's set of roles.- Parameters:
roles
- the new roles
-
getPendingToken
Gets the pending token information for this user, if any.- Returns:
- the pending token information or null if there is none
-
setPendingToken
Sets or clears the pending token information for this user.- Parameters:
pendingToken
- the pending token information or null to clear it
-
getSessions
Gets the current persistent sessions for this user.- Returns:
- the list of sessions
-
setSessions
Replaces the list of sessions by a new one.- Parameters:
sessions
- the new list of sessions
-
getApiTokens
Gets the long-term API tokens for this user- Returns:
- the API tokens
-
setApiTokens
Replaces the list of API tokens by a new one.- Parameters:
apiTokens
- the new API tokens
-
toString
-