Home Assistant Unofficial Reference 2024.12.1
homeassistant.auth.providers.homeassistant.Data Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass)
 
None add_auth (self, str username, str password)
 
None async_load (self)
 
None async_remove_auth (self, str username)
 
None async_save (self)
 
None change_password (self, str username, str new_password)
 
None change_username (self, str username, str new_username)
 
bytes hash_password (self, str password, bool for_storage=False)
 
str normalize_username (self, str username, *bool force_normalize=False)
 
list[dict[str, str]] users (self)
 
None validate_login (self, str username, str password)
 

Public Attributes

 hass
 
 is_legacy
 

Private Member Functions

None _async_check_for_not_normalized_usernames (self, dict[str, list[dict[str, str]]] data)
 
None _validate_new_username (self, str new_username)
 

Private Attributes

 _data
 
 _store
 

Detailed Description

Hold the user data.

Definition at line 80 of file homeassistant.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.auth.providers.homeassistant.Data.__init__ (   self,
HomeAssistant  hass 
)
Initialize the user data store.

Definition at line 83 of file homeassistant.py.

Member Function Documentation

◆ _async_check_for_not_normalized_usernames()

None homeassistant.auth.providers.homeassistant.Data._async_check_for_not_normalized_usernames (   self,
dict[str, list[dict[str, str]]]   data 
)
private

Definition at line 114 of file homeassistant.py.

◆ _validate_new_username()

None homeassistant.auth.providers.homeassistant.Data._validate_new_username (   self,
str  new_username 
)
private
Validate that username is normalized and unique.

Raises InvalidUsername if the new username is invalid.

Definition at line 238 of file homeassistant.py.

◆ add_auth()

None homeassistant.auth.providers.homeassistant.Data.add_auth (   self,
str  username,
str  password 
)
Add a new authenticated user/pass.

Raises InvalidUsername if the new username is invalid.

Definition at line 193 of file homeassistant.py.

◆ async_load()

None homeassistant.auth.providers.homeassistant.Data.async_load (   self)
Load stored data.

Definition at line 105 of file homeassistant.py.

◆ async_remove_auth()

None homeassistant.auth.providers.homeassistant.Data.async_remove_auth (   self,
str  username 
)
Remove authentication.

Definition at line 208 of file homeassistant.py.

◆ async_save()

None homeassistant.auth.providers.homeassistant.Data.async_save (   self)
Save data.

Definition at line 280 of file homeassistant.py.

◆ change_password()

None homeassistant.auth.providers.homeassistant.Data.change_password (   self,
str  username,
str  new_password 
)
Update the password.

Raises InvalidUser if user cannot be found.

Definition at line 223 of file homeassistant.py.

◆ change_username()

None homeassistant.auth.providers.homeassistant.Data.change_username (   self,
str  username,
str  new_username 
)
Update the username.

Raises InvalidUser if user cannot be found.
Raises InvalidUsername if the new username is invalid.

Definition at line 262 of file homeassistant.py.

◆ hash_password()

bytes homeassistant.auth.providers.homeassistant.Data.hash_password (   self,
str  password,
bool   for_storage = False 
)
Encode a password.

Definition at line 185 of file homeassistant.py.

◆ normalize_username()

str homeassistant.auth.providers.homeassistant.Data.normalize_username (   self,
str  username,
*bool   force_normalize = False 
)
Normalize a username based on the mode.

Definition at line 96 of file homeassistant.py.

◆ users()

list[dict[str, str]] homeassistant.auth.providers.homeassistant.Data.users (   self)
Return users.

Definition at line 155 of file homeassistant.py.

◆ validate_login()

None homeassistant.auth.providers.homeassistant.Data.validate_login (   self,
str  username,
str  password 
)
Validate a username and password.

Raises InvalidAuth if auth invalid.

Definition at line 160 of file homeassistant.py.

Member Data Documentation

◆ _data

homeassistant.auth.providers.homeassistant.Data._data
private

Definition at line 111 of file homeassistant.py.

◆ _store

homeassistant.auth.providers.homeassistant.Data._store
private

Definition at line 86 of file homeassistant.py.

◆ hass

homeassistant.auth.providers.homeassistant.Data.hass

Definition at line 85 of file homeassistant.py.

◆ is_legacy

homeassistant.auth.providers.homeassistant.Data.is_legacy

Definition at line 93 of file homeassistant.py.


The documentation for this class was generated from the following file: