|
862 | 862 | if SESSION_ENGINE in ("django.contrib.sessions.backends.cached_db", "django.contrib.sessions.backends.cache"): |
863 | 863 | SESSION_CACHE_ALIAS = "memcached" # use memcached cache if a cached backend is requested |
864 | 864 |
|
865 | | -# Security stuff |
866 | | - |
867 | | -# Require users to authenticate before using Geonode |
868 | | -LOCKDOWN_GEONODE = ast.literal_eval(os.getenv("LOCKDOWN_GEONODE", "False")) |
869 | | -# Require users to authenticate before using Geonode |
870 | | -if LOCKDOWN_GEONODE: |
871 | | - MIDDLEWARE += ("geonode.security.middleware.LoginRequiredMiddleware",) |
872 | | - |
873 | | -# LOCKDOWN API endpoints to prevent unauthenticated access. |
874 | | -# If set to True, search won't deliver results and filtering ResourceBase-objects is not possible for anonymous users |
875 | | -API_LOCKDOWN = ast.literal_eval(os.getenv("API_LOCKDOWN", "False")) |
| 865 | +# Add additional paths (as regular expressions) that don't require |
| 866 | +# authentication. |
| 867 | +# - authorized exempt urls needed for oauth when GeoNode is set to lockdown |
| 868 | +AUTH_EXEMPT_URLS = ( |
| 869 | + f"{FORCE_SCRIPT_NAME}/o/*", |
| 870 | + f"{FORCE_SCRIPT_NAME}/gs/*", |
| 871 | + f"{FORCE_SCRIPT_NAME}/account/*", |
| 872 | + f"{FORCE_SCRIPT_NAME}/static/*", |
| 873 | + f"{FORCE_SCRIPT_NAME}/api/o/*", |
| 874 | + f"{FORCE_SCRIPT_NAME}/api/roles", |
| 875 | + f"{FORCE_SCRIPT_NAME}/api/adminRole", |
| 876 | + f"{FORCE_SCRIPT_NAME}/api/users", |
| 877 | + f"{FORCE_SCRIPT_NAME}/api/datasets", |
| 878 | + r"^/i18n/setlang/?$", |
| 879 | +) |
876 | 880 |
|
| 881 | +# Security stuff |
877 | 882 | SESSION_EXPIRED_CONTROL_ENABLED = ast.literal_eval(os.environ.get("SESSION_EXPIRED_CONTROL_ENABLED", "True")) |
878 | 883 |
|
879 | 884 | if SESSION_EXPIRED_CONTROL_ENABLED: |
|
974 | 979 | # 1 day expiration time by default |
975 | 980 | ACCESS_TOKEN_EXPIRE_SECONDS = int(os.getenv("ACCESS_TOKEN_EXPIRE_SECONDS", "86400")) |
976 | 981 |
|
977 | | -# Add additional paths (as regular expressions) that don't require |
978 | | -# authentication. |
979 | | -# - authorized exempt urls needed for oauth when GeoNode is set to lockdown |
980 | | -AUTH_EXEMPT_URLS = ( |
981 | | - f"{FORCE_SCRIPT_NAME}/o/*", |
982 | | - f"{FORCE_SCRIPT_NAME}/gs/*", |
983 | | - f"{FORCE_SCRIPT_NAME}/account/*", |
984 | | - f"{FORCE_SCRIPT_NAME}/static/*", |
985 | | - f"{FORCE_SCRIPT_NAME}/api/o/*", |
986 | | - f"{FORCE_SCRIPT_NAME}/api/roles", |
987 | | - f"{FORCE_SCRIPT_NAME}/api/adminRole", |
988 | | - f"{FORCE_SCRIPT_NAME}/api/users", |
989 | | - f"{FORCE_SCRIPT_NAME}/api/datasets", |
990 | | - r"^/i18n/setlang/?$", |
991 | | -) |
992 | | - |
993 | 982 | ANONYMOUS_USER_ID = os.getenv("ANONYMOUS_USER_ID", "-1") |
994 | 983 | GUARDIAN_GET_INIT_ANONYMOUS_USER = os.getenv( |
995 | 984 | "GUARDIAN_GET_INIT_ANONYMOUS_USER", "geonode.people.models.get_anonymous_user_instance" |
|
1038 | 1027 | AUTHENTICATION_BACKENDS = ("geonode.security.backends.AdminRestrictedAccessBackend",) + AUTHENTICATION_BACKENDS |
1039 | 1028 | MIDDLEWARE += ("geonode.security.middleware.AdminAllowedMiddleware",) |
1040 | 1029 |
|
| 1030 | +# LOCKDOWN API endpoints to prevent unauthenticated access. |
| 1031 | +# If set to True, search won't deliver results and filtering ResourceBase-objects is not possible for anonymous users |
| 1032 | +API_LOCKDOWN = ast.literal_eval(os.getenv("API_LOCKDOWN", "False")) |
| 1033 | + |
| 1034 | +# Require users to authenticate before using Geonode |
| 1035 | +LOCKDOWN_GEONODE = ast.literal_eval(os.getenv("LOCKDOWN_GEONODE", "False")) |
| 1036 | +# Require users to authenticate before using Geonode |
| 1037 | +if LOCKDOWN_GEONODE: |
| 1038 | + MIDDLEWARE += ("geonode.security.middleware.LoginRequiredMiddleware",) |
| 1039 | + |
1041 | 1040 | # A tuple of hosts the proxy can send requests to. |
1042 | 1041 | try: |
1043 | 1042 | # try to parse python notation, default in dockerized env |
|
0 commit comments