Added field ip_auth to the Profile object. The backend compares search for the user with the specified ip_auth. The middleware checks the header REMOTE_ADDR (by default) for the IP address.
In order to use the middleware, add judge.middleware.IPBasedAuthMiddleware right after django.contrib.auth.middleware.AuthenticationMiddleware, e.g.
Modify the setting IP_BASED_AUTHENTICATION_HEADER in case another HTTP header is used for the IP address.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
[ ] Test A
[ ] Test B
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
[ ] I have explained the purpose of this PR.
[ ] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the README/documentation
[ ] Any dependent changes have been merged and published in downstream modules
[ ] Informed of breaking changes, testing and migrations (if applicable).
[ ] Attached screenshots (if applicable).
By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.
Description
Type of change: new feature
What
Added field
ip_auth
to the Profile object. The backend compares search for the user with the specifiedip_auth
. The middleware checks the headerREMOTE_ADDR
(by default) for the IP address.In order to use the middleware, add
judge.middleware.IPBasedAuthMiddleware
right afterdjango.contrib.auth.middleware.AuthenticationMiddleware
, e.g.Modify the setting
IP_BASED_AUTHENTICATION_HEADER
in case another HTTP header is used for the IP address.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.