Class ManagedUser

java.lang.Object
org.openhab.core.auth.ManagedUser
All Implemented Interfaces:
Principal, User, Identifiable<String>

@NonNullByDefault public class ManagedUser extends Object implements User
A User sourced from a managed UserProvider.
Author:
Yannick Schaus - initial contribution
  • Constructor Details

    • ManagedUser

      public ManagedUser(String name, String passwordSalt, String passwordHash)
      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 hash
      passwordHash - the result of the hashing of the salted password
  • Method Details

    • getPasswordHash

      public String getPasswordHash()
      Gets the password hash.
      Returns:
      the password hash
    • setPasswordSalt

      public void setPasswordSalt(String passwordSalt)
      Alters the password salt.
      Parameters:
      passwordSalt - the new password salt
    • setPasswordHash

      public void setPasswordHash(String passwordHash)
      Alters the password hash.
      Parameters:
      passwordHash - the new password hash
    • getPasswordSalt

      public String getPasswordSalt()
      Gets the password salt.
      Returns:
      the password salt
    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • setName

      public void setName(String name)
      Alters the user's account name
      Parameters:
      name - the new account name
    • getUID

      public String getUID()
      Description copied from interface: Identifiable
      Get the unique identifier.
      Specified by:
      getUID in interface Identifiable<String>
      Returns:
      the unique identifier
    • getRoles

      public Set<String> getRoles()
      Description copied from interface: User
      Gets the roles attributed to the user.
      Specified by:
      getRoles in interface User
      Returns:
      role attributed to the user
      See Also:
    • setRoles

      public void setRoles(Set<String> roles)
      Alters the user's set of roles.
      Parameters:
      roles - the new roles
    • getPendingToken

      public @Nullable PendingToken getPendingToken()
      Gets the pending token information for this user, if any.
      Returns:
      the pending token information or null if there is none
    • setPendingToken

      public void setPendingToken(@Nullable PendingToken pendingToken)
      Sets or clears the pending token information for this user.
      Parameters:
      pendingToken - the pending token information or null to clear it
    • getSessions

      public List<UserSession> getSessions()
      Gets the current persistent sessions for this user.
      Returns:
      the list of sessions
    • setSessions

      public void setSessions(List<UserSession> sessions)
      Replaces the list of sessions by a new one.
      Parameters:
      sessions - the new list of sessions
    • getApiTokens

      public List<UserApiToken> getApiTokens()
      Gets the long-term API tokens for this user
      Returns:
      the API tokens
    • setApiTokens

      public void setApiTokens(List<UserApiToken> apiTokens)
      Replaces the list of API tokens by a new one.
      Parameters:
      apiTokens - the new API tokens
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object