We need to implement a mixin that restricts access to Django views based on client IP addresses. This mixin will help in adding an additional layer of security by allowing or denying access to specific IP addresses.
Requirements
Mixin Functionality:
Create a mixin class IPRestrictionMixin that can be used with Django views.
Allow specifying allowed and denied IP addresses as class attributes.
Implement methods to check the client’s IP address against the allowed and denied lists.
Provide clear error messages when access is denied.
Integration:
Ensure compatibility with existing authentication and permission systems.
Acceptance Criteria
The mixin should be easy to use and integrate with existing Django views.
It should support both allow-lists (IP addresses that are permitted) and deny-lists (IP addresses that are blocked).
Access should be restricted based on the client’s IP address.
Description
We need to implement a mixin that restricts access to Django views based on client IP addresses. This mixin will help in adding an additional layer of security by allowing or denying access to specific IP addresses.
Requirements
Mixin Functionality:
IPRestrictionMixin
that can be used with Django views.Integration:
Acceptance Criteria