API: Unified authentication and logging middleware #523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request involves significant changes to the authentication middleware and the initialization of the server, focusing on refactoring and improving the codebase. The most important changes include the removal of deprecated dependencies, the addition of new authentication methods, and the restructuring of the server initialization process.
dep_current_user
anddep_current_user_optional
functions to use the new authentication middleware, removing redundant code and improving clarity.Improved logging
The new authentication middleware updates the log context, so all log messages produced by calling endpoints now contain information about the current user and the response status and can be matched by request_id
In the following example, users changes the status of an entity. example addon that listens to status_changed events processes the emitted event after the request ended, but logging messages triggered still contain the original context.