florist.api.auth.token module¶
Module for handling token and user creation.
- class AuthUser(**data)[source]¶
Bases:
BaseModel
Define the User model to be returned by the API.
- class OAuth2ChangePasswordRequestForm(*, grant_type=None, username, current_password, new_password)[source]¶
Bases:
OAuth2PasswordRequestForm
Define the model for the change password request.
Extends the OAuth2PasswordRequestForm model to add a new_password and a current_password field.
- class Token(**data)[source]¶
Bases:
BaseModel
Define the Token model.
- create_access_token(data, secret_key, expiration_delta=datetime.timedelta(days=7))[source]¶
Create an access token.
- make_default_client_user()[source]¶
Make a default client user.
- Return type:
- Returns:
(User) the default client user.
- async make_default_server_user(database)[source]¶
Make a default server user.
- Parameters:
database (
AsyncIOMotorDatabase
) – (AsyncIOMotorDatabase[Any]) the database to create the user in.- Return type:
- Returns:
(User) the default server user.