Package org.openhab.core.auth
Interface UserRegistry
- All Superinterfaces:
- AuthenticationProvider,- Registry<User,- String> 
@NonNullByDefault
public interface UserRegistry
extends Registry<User,String>, AuthenticationProvider 
An interface for a generic 
Registry of User entities. User registries can also be used as
 AuthenticationProvider.- Author:
- Yannick Schaus - initial contribution
- 
Method SummaryModifier and TypeMethodDescriptionaddUserApiToken(User user, String name, String scope) Adds a new API token to the user profile.voidaddUserSession(User user, UserSession session) Adds a new session to the user profilevoidchangePassword(User user, String newPassword) Change the password for aUserin this registry.voidclearSessions(User user) Clears all sessions from the user profileAdds a newUserin this registry.voidremoveUserApiToken(User user, UserApiToken apiToken) Removes the specified API token from the user profilevoidremoveUserSession(User user, UserSession session) Removes the specified session from the user profileMethods inherited from interface org.openhab.core.auth.AuthenticationProviderauthenticate, supportsMethods inherited from interface org.openhab.core.common.registry.Registryadd, addRegistryChangeListener, get, getAll, remove, removeRegistryChangeListener, stream, update
- 
Method Details- 
registerAdds a newUserin this registry. The implementation receives the clear text credentials and is responsible for their secure storage (for instance by hashing the password), then return the newly createdUserinstance.- Parameters:
- username- the username of the new user
- password- the user password
- roles- the roles attributed to the new user
- Returns:
- the new registered Userinstance
 
- 
changePasswordChange the password for aUserin this registry. The implementation receives the new password and is responsible for their secure storage (for instance by hashing the password).- Parameters:
- user- the username of the existing user
- newPassword- the new password
 
- 
addUserSessionAdds a new session to the user profile- Parameters:
- user- the user
- session- the session to add
 
- 
removeUserSessionRemoves the specified session from the user profile- Parameters:
- user- the user
- session- the session to remove
 
- 
clearSessionsClears all sessions from the user profile- Parameters:
- user- the user
 
- 
addUserApiTokenAdds a new API token to the user profile. The implementation is responsible for storing the token in a secure way (for instance by hashing it).- Parameters:
- user- the user
- name- the name of the API token to create
- scope- the scope this API token will be valid for
- Returns:
- the string that can be used as a Bearer token to match the new API token
 
- 
removeUserApiTokenRemoves the specified API token from the user profile- Parameters:
- user- the user
- apiToken- the API token
 
 
-