mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-03-18 19:12:07 +00:00
perf: domains set to any
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
import os
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.cache import cache
|
||||
@@ -111,10 +112,12 @@ class SessionAuthentication(authentication.SessionAuthentication):
|
||||
if not user or not user.is_active or not user.is_valid:
|
||||
return None
|
||||
|
||||
try:
|
||||
self.enforce_csrf(request)
|
||||
except exceptions.AuthenticationFailed:
|
||||
return None
|
||||
ignore_csrf_check = os.environ.get("DOMAINS", "") == "*"
|
||||
if not ignore_csrf_check:
|
||||
try:
|
||||
self.enforce_csrf(request)
|
||||
except exceptions.AuthenticationFailed:
|
||||
return None
|
||||
|
||||
# CSRF passed with authenticated user
|
||||
return user, None
|
||||
|
||||
@@ -198,5 +198,6 @@ class SafeRedirectMiddleware:
|
||||
class CsrfCheckMiddleware(CsrfViewMiddleware):
|
||||
def _origin_verified(self, request):
|
||||
if IGNORE_CSRF_CHECK:
|
||||
request._dont_enforce_csrf_checks = True
|
||||
return True
|
||||
return super()._origin_verified(request)
|
||||
|
||||
@@ -118,6 +118,7 @@ BOOTSTRAP3 = {
|
||||
REDIS_LAYERS_HOST = {
|
||||
'db': CONFIG.REDIS_DB_WS,
|
||||
}
|
||||
USE_X_FORWARDED_HOST = True
|
||||
|
||||
REDIS_LAYERS_SSL_PARAMS = {}
|
||||
if REDIS_USE_SSL:
|
||||
|
||||
Reference in New Issue
Block a user