未提供项目描述
项目描述
django-front-door
简单、易于使用的中介件,用于基于请求属性锁定对任何django应用的访问。
快速入门
尽可能早地将FrontDoorMiddleware
添加到您的settings.MIDDLEWARE
中。
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
项目详情
关闭
django-front-door-0.10.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 6c169a829b86d2a8e4bb1365af8a04d54cd5ef1787b0e9c720231c0bdb51abf1 |
|
MD5 | 1f947f59f6c8eaa5ee2018ecee3e085d |
|
BLAKE2b-256 | 950cb8df400373338ef2ef0a795d26210186b41df73b83ce079251453e023433 |