class CredentialsManager: (source)
A class to manage credentials for the CSE.
It is mainly managed and used by the SecurityManager to handle authentication
and authorization of requests. It reads authentication data from specified files
and provides methods to access this data for security checks.
It does not refresh the data automatically, so if the authentication files are updated, the respective read methods should be called again to refresh the data in memory.
| Method | add |
Add HTTP basic authentication credentials to the file and update the in-memory data. The credentials are stored as username:password. |
| Method | add |
Add HTTP or WebSocket token authentication credentials to the file and update the in-memory data. The credentials are stored as token. |
| Method | delete |
Delete HTTP or WebSocket basic authentication credentials from the file and update the in-memory data. The credentials are stored as username:password. |
| Method | delete |
Delete HTTP or WebSocket token credentials from the file and update the in-memory data. The credentials are stored as token. |
| Method | initialize |
Initialize the CertificateManager. |
| Method | read |
Read the HTTP basic authentication file and store the data in a dictionary. The authentication information is stored as username:password. |
| Method | read |
Read the HTTP token authentication file and store the data in a dictionary. The authentication information is stored as a single token per line. |
| Method | read |
Read the WebSocket basic authentication file and store the data in a dictionary. The authentication information is stored as username:password. |
| Method | read |
Read the WebSocket token authentication file and store the data in a dictionary. The authentication information is stored as a single token per line. |
| Method | update |
Update HTTP or WebSocket basic authentication credentials in the file and update the in-memory data. The credentials are stored as username:password. |
| Method | update |
Update HTTP or WebSocket token authentication credentials in the file and update the in-memory data. The credentials are stored as token. |
| Class Variable | __slots__ |
Slots for CertificateManager class. |
| Class Variable | http |
The injected HttpServer plugin instance. |
| Class Variable | websocket |
The injected WebSocketServer plugin instance. |
| Instance Variable | http |
Dictionary to store the HTTP Basic Authentication data, mapping originators to their hashed passwords. |
| Instance Variable | http |
List to store the HTTP Token Authentication data. |
| Instance Variable | ws |
Dictionary to store the WebSocket Basic Authentication data, mapping originators to their hashed passwords. |
| Instance Variable | ws |
List to store the WebSocket Token Authentication data. |
Add HTTP basic authentication credentials to the file and update the in-memory data. The credentials are stored as username:password.
| Parameters | |
username:str | The username to add. |
password:str | The password to add. |
ty:BindingType | The type of credentials to add. |
| Raises | |
ValueError | If there is an error adding the credentials. |
Add HTTP or WebSocket token authentication credentials to the file and update the in-memory data. The credentials are stored as token.
| Parameters | |
token:str | The token to add. |
ty:BindingType | The type of credentials to add. |
| Raises | |
ValueError | If there is an error adding the credentials. |
Delete HTTP or WebSocket basic authentication credentials from the file and update the in-memory data. The credentials are stored as username:password.
| Parameters | |
id:str | The username or token to delete. |
ty:BindingType | Undocumented |
| Raises | |
ValueError | If there is an error deleting the credentials. |
Delete HTTP or WebSocket token credentials from the file and update the in-memory data. The credentials are stored as token.
| Parameters | |
token:str | The token to delete. |
ty:BindingType | Undocumented |
| Raises | |
ValueError | If there is an error deleting the credentials. |
Read the HTTP basic authentication file and store the data in a dictionary. The authentication information is stored as username:password.
The data is stored in the httpBasicAuthData dictionary.
| Raises | |
ValueError | If there is an error reading the basic authentication file. |
Read the HTTP token authentication file and store the data in a dictionary. The authentication information is stored as a single token per line.
The data is stored in the httpTokenAuthData list.
| Raises | |
ValueError | If there is an error reading the token authentication file. |
Read the WebSocket basic authentication file and store the data in a dictionary. The authentication information is stored as username:password.
The data is stored in the wsBasicAuthData dictionary.
| Raises | |
ValueError | If there is an error reading the basic authentication file. |
Read the WebSocket token authentication file and store the data in a dictionary. The authentication information is stored as a single token per line.
The data is stored in the wsTokenAuthData list.
| Raises | |
ValueError | If there is an error reading the token authentication file. |
Update HTTP or WebSocket basic authentication credentials in the file and update the in-memory data. The credentials are stored as username:password.
| Parameters | |
username:str | The username to update. |
password:str | The new password to set. |
ty:BindingType | The type of credentials to update. |
| Raises | |
ValueError | If there is an error updating the credentials. |
Update HTTP or WebSocket token authentication credentials in the file and update the in-memory data. The credentials are stored as token.
| Parameters | |
token:str | The token to update. |
nt:str | The new token to set. |
ty:BindingType | The type of credentials to update. |
Dictionary to store the HTTP Basic Authentication data, mapping originators to their hashed passwords.