Skip to main content

No project description provided

Project description

django-front-door

Simple, easy to use, middleware to lock access to any django app based on request attributes.

Quick Start

Add FrontDoorMiddleware to your settings.MIDDLEWARE as first as possible.

MIDDLEWARE = (
     'front_door.middleware.FrontDoorMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
)
FRONT_DOOR_ALLOWED_IPS=[],  # allowed ips
FRONT_DOOR_ALLOWED_PATHS=[],  # url paths regex list always allowed
FRONT_DOOR_COOKIE_NAME=None,
FRONT_DOOR_COOKIE_PATTERN=None,
FRONT_DOOR_LOG_LEVEL=0 #
FRONT_DOOR_DEFAULT_POLICY=FORBID,
FRONT_DOOR_ENABLED=False,  # FrontDoor enable/disable
FRONT_DOOR_ERROR_CODE=404,  # status code if access denied
FRONT_DOOR_FORBIDDEN_PATHS=[],  # url paths regex list always denied
FRONT_DOOR_HEADER=None,  # special header name without HTTP- prefix
FRONT_DOOR_REDIR_URL="",  # HttpResponseRedirect(REDIR_URL) if access denied
FRONT_DOOR_ROUTER="front_door.router.DefaultRouter",
FRONT_DOOR_RULES=[
        "front_door.rules.internal_ip",  # grant access to settings.INTERNAL_IPS
        "front_door.rules.forbidden_path",  # DENY access to FORBIDDEN_PATHS
        "front_door.rules.allowed_ip",  # grant access to FORBIDDEN_PATHS
        "front_door.rules.allowed_path",  # grant access to ALLOWED_PATHS
        "front_door.rules.special_header",  # grant access if request has Header[HEADER] == TOKEN
        "front_door.rules.has_header",  # grant access if request has HEADER
        "front_door.rules.cookie_value",  # grant access if request.COOKIES[COOKIE_NAME]
        "front_door.rules.cookie_exists",  # grant access ir COOKIE_NAME in request.COOKIES
    ],
FRONT_DOOR_TOKEN=None,  # custom header value

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-front-door-0.9.0.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file django-front-door-0.9.0.tar.gz.

File metadata

  • Download URL: django-front-door-0.9.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for django-front-door-0.9.0.tar.gz
Algorithm Hash digest
SHA256 c1b1ef920340e88f72b68d361a0e2aa97f03f228d2dbf839da9fadc3f06a0bf1
MD5 8b1201a727031c6d6f5c538062078d48
BLAKE2b-256 e7efa4928270152f183d56583f75ed3a3bbbf9a43d6adddafeca56c4e270c437

See more details on using hashes here.

Provenance

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