mirror of https://github.com/zulip/zulip.git
auth: Add social_backends to /server_settings.
This commit is contained in:
parent
892d25faa1
commit
db29fcbbc4
|
@ -2099,6 +2099,11 @@ paths:
|
||||||
description: Each key-value pair in the object indicates
|
description: Each key-value pair in the object indicates
|
||||||
whether the authentication method is enabled on this
|
whether the authentication method is enabled on this
|
||||||
server.
|
server.
|
||||||
|
social_backends:
|
||||||
|
type: array
|
||||||
|
description: List of "social backend" objects, describing which
|
||||||
|
social backends are enabled and their parameters - most importantly
|
||||||
|
the login url, display_name and display_logo.
|
||||||
zulip_version:
|
zulip_version:
|
||||||
type: string
|
type: string
|
||||||
description: The version of Zulip running in the server.
|
description: The version of Zulip running in the server.
|
||||||
|
|
|
@ -33,7 +33,7 @@ from zerver.lib.avatar_hash import user_avatar_path
|
||||||
from zerver.lib.dev_ldap_directory import generate_dev_ldap_dir
|
from zerver.lib.dev_ldap_directory import generate_dev_ldap_dir
|
||||||
from zerver.lib.mobile_auth_otp import otp_decrypt_api_key
|
from zerver.lib.mobile_auth_otp import otp_decrypt_api_key
|
||||||
from zerver.lib.validator import validate_login_email, \
|
from zerver.lib.validator import validate_login_email, \
|
||||||
check_bool, check_dict_only, check_string, Validator
|
check_bool, check_dict_only, check_list, check_string, Validator
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.storage import static_path
|
from zerver.lib.storage import static_path
|
||||||
from zerver.lib.users import get_all_api_keys
|
from zerver.lib.users import get_all_api_keys
|
||||||
|
@ -57,7 +57,8 @@ from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
|
||||||
require_email_format_usernames, AUTH_BACKEND_NAME_MAP, \
|
require_email_format_usernames, AUTH_BACKEND_NAME_MAP, \
|
||||||
ZulipLDAPConfigurationError, ZulipLDAPExceptionOutsideDomain, \
|
ZulipLDAPConfigurationError, ZulipLDAPExceptionOutsideDomain, \
|
||||||
ZulipLDAPException, query_ldap, sync_user_from_ldap, SocialAuthMixin, \
|
ZulipLDAPException, query_ldap, sync_user_from_ldap, SocialAuthMixin, \
|
||||||
PopulateUserLDAPError, SAMLAuthBackend, saml_auth_enabled, email_belongs_to_ldap
|
PopulateUserLDAPError, SAMLAuthBackend, saml_auth_enabled, email_belongs_to_ldap, \
|
||||||
|
get_social_backend_dicts
|
||||||
|
|
||||||
from zerver.views.auth import (maybe_send_to_registration,
|
from zerver.views.auth import (maybe_send_to_registration,
|
||||||
_subdomain_token_salt)
|
_subdomain_token_salt)
|
||||||
|
@ -1836,10 +1837,12 @@ class FetchAuthBackends(ZulipTestCase):
|
||||||
]
|
]
|
||||||
for backend_name_with_case in AUTH_BACKEND_NAME_MAP:
|
for backend_name_with_case in AUTH_BACKEND_NAME_MAP:
|
||||||
authentication_methods_list.append((backend_name_with_case.lower(), check_bool))
|
authentication_methods_list.append((backend_name_with_case.lower(), check_bool))
|
||||||
|
social_backends = get_social_backend_dicts()
|
||||||
|
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
checker = check_dict_only([
|
checker = check_dict_only([
|
||||||
('authentication_methods', check_dict_only(authentication_methods_list)),
|
('authentication_methods', check_dict_only(authentication_methods_list)),
|
||||||
|
('social_backends', check_list(None, length=len(social_backends))),
|
||||||
('email_auth_enabled', check_bool),
|
('email_auth_enabled', check_bool),
|
||||||
('is_incompatible', check_bool),
|
('is_incompatible', check_bool),
|
||||||
('require_email_format_usernames', check_bool),
|
('require_email_format_usernames', check_bool),
|
||||||
|
|
|
@ -847,7 +847,8 @@ def api_get_server_settings(request: HttpRequest) -> HttpResponse:
|
||||||
"realm_uri",
|
"realm_uri",
|
||||||
"realm_name",
|
"realm_name",
|
||||||
"realm_icon",
|
"realm_icon",
|
||||||
"realm_description"]:
|
"realm_description",
|
||||||
|
"social_backends"]:
|
||||||
if context[settings_item] is not None:
|
if context[settings_item] is not None:
|
||||||
result[settings_item] = context[settings_item]
|
result[settings_item] = context[settings_item]
|
||||||
return json_success(result)
|
return json_success(result)
|
||||||
|
|
Loading…
Reference in New Issue