Skip to main content
Info:

Super simple password protection for limiting public access to pages and assets

Version:
0.2.1
Author:

Ben Lopatin (http://benlopatin.com)

Django Simple Auth is a secondary authentication system for protecting any URLs served by your application from public access. It does not replace your authentication system. Rather its purpose is to provide very simple a simple password for non-public information like shared photo galleries.

Installing

First add the application to your Python path. The easiest way is to use pip:

pip install django-simple-auth

As of version 0.2.0 this is only tested against Django 1.11+ and is probably compatible with Django 1.10 but this has not been tested.

Configuring

Make sure you have django.contrib.auth installed, and add the simple_auth application to your INSTALLED_APPS list:

INSTALLED_APPS = [
    ...
    'django.contrib.auth',
    'simple_auth',
]

Next add simple_auth.urls to your project URLs.:

...
url(r'^protect/', include('simple_auth.urls')),

If you want to enable default rule-based limits on your site, install the SimpleAuthMiddleware:

MIDDLEWARE = [
    ...
    'simple_auth.middleware.SimpleAuthMiddleware',
]

By default this will require a password for all URLs except for URLs prefaced with /admin/. These URLs can be overridden using protect and ignore settings.:

SIMPLE_AUTH_IGNORE = [
    r'^admin/,
    r'^$',
]

SIMPLE_AUTH_PROTECT = [
    r'^forums/'
    r^blog/',
    r^secret_page.html$',
]

If a URL is listed in both the ignore and protect lists the default will be to protect the URL and simple_auth will emit a warning.

Usage overview

There are two ways to protect pages and assets: view decorators and middleware.

These methods will always allow authenticated users to access the URL.

Middleware

To enable the middleware install the middleware class as described in the installation section.

Individual views

Note: not implemented yet.

For function views:

from simple_auth import simple_auth_required

@simple_auth_required
def myview(request):
    ...

For class-based views:

from simple_auth import SimpleAuthMixin

class MyView(SimpleAuthMixin, DetailView):
    ...

Metadata

Release files for django-simple-auth 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-simple-auth 0.2.1
File Size Uploaded Provenance
django-simple-auth-0.2.1.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-simple-auth 0.2.1
File Interpreter ABI Platform
django_simple_auth-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 14.0 kB

Release files / django-simple-auth-0.2.1.tar.gz

Download URL django-simple-auth-0.2.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c7540e293cc542ac1f6d4c8b35c75bb042a3517ca67a0c0137ca65dd908054e0
BLAKE2b-256 checksum
How to use checksums
7059aa1afae1fb067fabeae5da1505398b549af69fc07dda30df9910d4811226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_simple_auth-0.2.1-py2.py3-none-any.whl

Download URL django_simple_auth-0.2.1-py2.py3-none-any.whl
Size 8.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9f5730bed80bb7a7526466ff502814fae1b6e5f76fb59678d86155c30560581c
BLAKE2b-256 checksum
How to use checksums
b090a554ee22ce4f005b32edbb524181e29528ad5ab3271b7406e83cf3039ecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-simple-auth 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page