florist.api.routes.server.auth module¶
FastAPI server routes for authentication.
- async change_password(form_data, request)[source]¶
Change the password for the user.
- Parameters:
form_data (
OAuth2ChangePasswordRequestForm
) – (OAuth2ChangePasswordForm) The form data from the change password request. It must contain the username, current_password, and new_password fields.request (
Request
) – (Request) The request object.
- Return type:
- Returns:
(Token) The access token.
- async check_default_user_token(token, request)[source]¶
Validate the default user against the token.
- get_client_token(client_info, request)[source]¶
Retrieve a valid client token.
Checks if the client has a valid token in the request.app.clients_auth_tokens dictionary by checking it against the connect client endpoint. If it does, then it returns the token. If it does not, then it will call the authentication endpoint for the client to get a valid token, store it in the request.app.clients_auth_tokens dictionary, and then return the token.
- Parameters:
client_info (
ClientInfo
) – (ClientInfo) The client information object.request (
Request
) – (Request) The FastAPI request object.
- Return type:
- Returns:
(Token) A valid client token.
- async login_for_access_token(form_data, request)[source]¶
Make a login request to get an access token.
- Parameters:
form_data (
OAuth2PasswordRequestForm
) – (OAuth2PasswordRequestForm) The form data from the login request. It must contain the username and password fields.request (
Request
) – (Request) The request object.
- Return type:
- Returns:
(Token) The access token.
- Raise:
(HTTPException) If the user does not exist or the password is incorrect.