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 Summary
Modifier 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.AuthenticationProvider
authenticate, supportsMethods inherited from interface org.openhab.core.common.registry.Registry
add, addRegistryChangeListener, get, getAll, remove, removeRegistryChangeListener, stream, update
-
Method Details
-
register
Adds 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 userpassword- the user passwordroles- the roles attributed to the new user- Returns:
- the new registered
Userinstance
-
changePassword
Change 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 usernewPassword- the new password
-
addUserSession
Adds a new session to the user profile- Parameters:
user- the usersession- the session to add
-
removeUserSession
Removes the specified session from the user profile- Parameters:
user- the usersession- the session to remove
-
clearSessions
Clears all sessions from the user profile- Parameters:
user- the user
-
addUserApiToken
Adds 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 username- the name of the API token to createscope- 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
-
removeUserApiToken
Removes the specified API token from the user profile- Parameters:
user- the userapiToken- the API token
-