mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
auth: Allow easier bouncer testing in dev env.
This commit is contained in:
committed by
Tim Abbott
parent
ab633f4557
commit
8254b74019
@@ -2,6 +2,7 @@ import logging
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django.urls.resolvers import URLPattern
|
from django.urls.resolvers import URLPattern
|
||||||
@@ -81,8 +82,11 @@ def validate_remote_server(
|
|||||||
|
|
||||||
if remote_server.deactivated:
|
if remote_server.deactivated:
|
||||||
raise RemoteServerDeactivatedError
|
raise RemoteServerDeactivatedError
|
||||||
|
if (
|
||||||
if get_subdomain(request) != Realm.SUBDOMAIN_FOR_ROOT_DOMAIN:
|
get_subdomain(request) != Realm.SUBDOMAIN_FOR_ROOT_DOMAIN
|
||||||
|
and not settings.DEVELOPMENT_DISABLE_PUSH_BOUNCER_DOMAIN_CHECK
|
||||||
|
):
|
||||||
|
# Sometimes we may want to test push bouncer logic in development.
|
||||||
raise JsonableError(_("Invalid subdomain for push notifications bouncer"))
|
raise JsonableError(_("Invalid subdomain for push notifications bouncer"))
|
||||||
RequestNotes.get_notes(request).remote_server = remote_server
|
RequestNotes.get_notes(request).remote_server = remote_server
|
||||||
process_client(request)
|
process_client(request)
|
||||||
|
|||||||
@@ -309,6 +309,12 @@ TUTORIAL_ENABLED = True
|
|||||||
# them easily through /emails page
|
# them easily through /emails page
|
||||||
DEVELOPMENT_LOG_EMAILS = DEVELOPMENT
|
DEVELOPMENT_LOG_EMAILS = DEVELOPMENT
|
||||||
|
|
||||||
|
# The push bouncer expects to get its requests on the root subdomain,
|
||||||
|
# but that makes it more of a hassle to test bouncer endpoints in
|
||||||
|
# the development environment - so this setting allows us to disable
|
||||||
|
# that check.
|
||||||
|
DEVELOPMENT_DISABLE_PUSH_BOUNCER_DOMAIN_CHECK = False
|
||||||
|
|
||||||
|
|
||||||
# These settings are not documented in prod_settings_template.py.
|
# These settings are not documented in prod_settings_template.py.
|
||||||
# They should either be documented here, or documented there.
|
# They should either be documented here, or documented there.
|
||||||
|
|||||||
@@ -203,3 +203,10 @@ SCIM_CONFIG: Dict[str, SCIMConfigDict] = {
|
|||||||
"name_formatted_included": True,
|
"name_formatted_included": True,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# You can uncomment these lines to use the development environment
|
||||||
|
# server as a dummy push bouncer for itself, to test functionalities
|
||||||
|
# such as register_server or update_analytics_counts management commands
|
||||||
|
# or others involving new bouncer-side logic.
|
||||||
|
# DEVELOPMENT_DISABLE_PUSH_BOUNCER_DOMAIN_CHECK = True
|
||||||
|
# PUSH_NOTIFICATION_BOUNCER_URL = "http://localhost:9991"
|
||||||
|
|||||||
Reference in New Issue
Block a user