stockstert.db.auth package¶
Submodules¶
stockstert.db.auth.ApiKey module¶
-
class
stockstert.db.auth.ApiKey.
ApiKey
(*args, **kwargs)¶ Bases:
stockstert.db.ModelMixin.ModelMixin
,sqlalchemy.ext.declarative.api.Model
Model that describes the ‘api_keys’ SQL table An ApiKey is used for API access using HTTP basic auth
-
MAX_AGE
= 2592000¶ The maximum age of an API key in seconds
-
__init__
(*args, **kwargs)¶ Initializes the Model :param args: The constructor arguments :param kwargs: The constructor keyword arguments
-
creation_time
¶ The time at which this API key was created as a UNIX timestamp
-
has_expired
() → bool¶ Checks if the API key has expired. API Keys expire after 30 days :return: True if the key has expired, False otherwise
-
id
¶
-
key_hash
¶ The hash of the API key
-
user
¶ The user associated with this API key
-
user_id
¶ The ID of the user associated with this API key
-
verify_key
(key: str) → bool¶ Checks if a given key is valid :param key: The key to check :return: True if the key is valid, False otherwise
-
stockstert.db.auth.User module¶
-
class
stockstert.db.auth.User.
User
(*args, **kwargs)¶ Bases:
stockstert.db.ModelMixin.ModelMixin
,sqlalchemy.ext.declarative.api.Model
Model that describes the ‘users’ SQL table A User stores a user’s information, including their email address, username and password hash
-
__init__
(*args, **kwargs)¶ Initializes the Model :param args: The constructor arguments :param kwargs: The constructor keyword arguments
-
api_keys
¶
-
confirmation_hash
¶ The account’s confirmation hash. This is the hash of a key emailed to the user. Only once the user follows the link in the email containing the key will their account be activated
-
confirmed
¶ The account’s confirmation status. Logins should be impossible as long as this value is False.
-
email
¶ The user’s email address
-
get_id
() → str¶ Method required by flask-login :return: The user’s ID as a unicode string
-
id
¶
-
property
is_active
¶ Property required by flask-login :return: True
-
property
is_anonymous
¶ Property required by flask-login :return: True if the user is not confirmed, False otherwise
-
property
is_authenticated
¶ Property required by flask-login :return: True if the user is confirmed, False otherwise
-
password_hash
¶ The user’s hashed password, salted and hashed.
-
username
¶ The user’s username
-
verify_password
(password: str) → bool¶ Verifies a password against the password hash :param password: The password to check :return: True if the password matches, False otherwise
-