-
-
Notifications
You must be signed in to change notification settings - Fork 801
adds support for auth proxy header #1859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
714efe6 to
2a306f4
Compare
d46d469 to
7a7a494
Compare
Useful if you have authentication in front of wger, and want to use that instead of wgers authentication/signup methods.
|
Maybe this should only be checked for |
|
BTW I haven't forgotte about this PR, but since it would add a new auth method I'd like to make sure we do it right. I've added this to the 2.4 backlog (so after the flexible routines get merged) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for authentication via a proxy header by introducing new settings, middleware, and an authentication backend, along with tests to verify the feature.
- Added new settings and middleware in wger/settings_global.py to support proxy-based authentication.
- Introduced AuthProxyHeaderMiddleware and AuthProxyUserBackend in wger/core to authenticate users based on a trusted header.
- Added comprehensive tests in wger/core/tests to validate the auth proxy behavior and updated the production settings.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wger/settings_global.py | Added new settings and registered the auth proxy middleware and backend. |
| wger/settings.tpl | Documented usage of the auth proxy header setting. |
| wger/core/tests/test_auch_proxy_middleware.py | Added tests covering various auth proxy scenarios. |
| wger/core/middleware.py | Introduced middleware to authenticate users via a trusted proxy header. |
| wger/core/backends.py | Implemented a custom backend for proxy header-based authentication. |
| extras/docker/production/settings.py | Configured the necessary auth proxy settings for the production environment. |
Comments suppressed due to low confidence (1)
wger/core/tests/test_auch_proxy_middleware.py:1
- [nitpick] The file name 'test_auch_proxy_middleware.py' appears to have a typo; consider renaming it to 'test_auth_proxy_middleware.py' for clarity.
# This file is part of wger Workout Manager.
We now properly redirect logged-out users to the login page, instead of only showing a permission denied error. If a user is already logged in, and they visit the page, they are redirected to the url in "next". We also now only apply the auth header checks there.
This allows setting directly these values for new users created through the auth proxy.
Otherwise, it is possible to land on the login page being logged-in, but having to do a reload first to actually being redirected to the dashboard.
d5ce854 to
e374712
Compare
Useful if you have authentication in front of wger, and want to use that instead of wgers authentication/signup methods.
Proposed Changes
Added a new setting, which can be used to setup proxy auth header, e.g. using Authelia to authenticate + create users on the instance.
Fixes #1847 , and potential VERY SIMPLE solution for #1805 ( #1797 )
Please check that the PR fulfills these requirements
Other questions
(e.g. database migration)? No
Remaining work