Skip to main content

IP number based authentication for Django

Project description

To install add the middleware to MIDDLEWARE_CLASSES:

'django_ip_authn.authentication.Middleware',

You also need to add the authentication backend to AUTHENTICATION_BACKENDS. This will probably not already exist, in which case you will want the entirety of this:

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'django_ip_authn.authentication.Authenticate',
)

By default it will not authenticate until you also add in the IP numbers that it should allow:

VALID_IP_NUMBERS = [
    '127.0.0.1', '127.0.1.1', # Allow only localhost IP numbers
]

Currently it will automatically allow the user with ID 1, this is the user that you create during the initial database creation in Django.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_ip_authn-0.2.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file django_ip_authn-0.2.tar.gz.

File metadata

File hashes

Hashes for django_ip_authn-0.2.tar.gz
Algorithm Hash digest
SHA256 6ec8ec208000c2cb9058e8d503a28c1965d7d04b6a9eb5cfcf9bc3e9ede0f3a2
MD5 0c124d7e4b8a9f74b2c6b42acab91516
BLAKE2b-256 338f4dc241893a27e2cd9fd593cc42cd071d6aad2920def044f6e61b0496d4d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page