mirror of https://github.com/zulip/zulip.git
auth: Report to mobile apps the availability of RemoteUserBackend.
This is necessary for mobile apps to do the right thing when only RemoteUserBackend is enabled, namely, directly redirect to the third-party SSO auth site as soon as the user enters the server URL (no need to display a login form, since it'll be useless).
This commit is contained in:
parent
cab3c8c32c
commit
34efab9157
|
@ -1320,6 +1320,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
('email', check_bool),
|
||||
('ldap', check_bool),
|
||||
('dev', check_bool),
|
||||
('remoteuser', check_bool),
|
||||
('password', check_bool),
|
||||
])),
|
||||
('email_auth_enabled', check_bool),
|
||||
|
@ -1353,7 +1354,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
data = result.json()
|
||||
self.assertEqual(set(data.keys()),
|
||||
{'msg', 'password', 'github', 'google', 'email', 'ldap',
|
||||
'dev', 'result', 'zulip_version'})
|
||||
'dev', 'result', 'remoteuser', 'zulip_version'})
|
||||
for backend in set(data.keys()) - {'msg', 'result', 'zulip_version'}:
|
||||
self.assertTrue(isinstance(data[backend], bool))
|
||||
|
||||
|
@ -1371,6 +1372,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
'dev': True,
|
||||
'email': False,
|
||||
'ldap': False,
|
||||
'remoteuser': False,
|
||||
'result': 'success',
|
||||
'zulip_version': ZULIP_VERSION,
|
||||
})
|
||||
|
@ -1387,6 +1389,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
'google': True,
|
||||
'email': False,
|
||||
'ldap': False,
|
||||
'remoteuser': False,
|
||||
'dev': True,
|
||||
'result': 'success',
|
||||
'zulip_version': ZULIP_VERSION,
|
||||
|
@ -1412,6 +1415,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
'google': False,
|
||||
'email': False,
|
||||
'ldap': False,
|
||||
'remoteuser': False,
|
||||
'dev': True,
|
||||
'result': 'success',
|
||||
'zulip_version': ZULIP_VERSION,
|
||||
|
@ -1433,6 +1437,7 @@ class FetchAuthBackends(ZulipTestCase):
|
|||
'github': False,
|
||||
'google': False,
|
||||
'email': False,
|
||||
'remoteuser': False,
|
||||
'ldap': False,
|
||||
'dev': True,
|
||||
'result': 'success',
|
||||
|
|
|
@ -35,7 +35,8 @@ from zerver.models import PreregistrationUser, UserProfile, remote_user_to_email
|
|||
from zerver.signals import email_on_new_login
|
||||
from zproject.backends import password_auth_enabled, dev_auth_enabled, \
|
||||
github_auth_enabled, google_auth_enabled, ldap_auth_enabled, \
|
||||
ZulipLDAPConfigurationError, ZulipLDAPAuthBackend, email_auth_enabled
|
||||
ZulipLDAPConfigurationError, ZulipLDAPAuthBackend, email_auth_enabled, \
|
||||
remote_auth_enabled
|
||||
from version import ZULIP_VERSION
|
||||
|
||||
import hashlib
|
||||
|
@ -698,6 +699,7 @@ def get_auth_backends_data(request: HttpRequest) -> Dict[str, Any]:
|
|||
"email": email_auth_enabled(realm),
|
||||
"github": github_auth_enabled(realm),
|
||||
"google": google_auth_enabled(realm),
|
||||
"remoteuser": remote_auth_enabled(realm),
|
||||
"ldap": ldap_auth_enabled(realm),
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ def google_auth_enabled(realm: Optional[Realm]=None) -> bool:
|
|||
def github_auth_enabled(realm: Optional[Realm]=None) -> bool:
|
||||
return auth_enabled_helper(['GitHub'], realm)
|
||||
|
||||
def remote_auth_enabled(realm: Optional[Realm]=None) -> bool:
|
||||
return auth_enabled_helper(['RemoteUser'], realm)
|
||||
|
||||
def any_oauth_backend_enabled(realm: Optional[Realm]=None) -> bool:
|
||||
"""Used by the login page process to determine whether to show the
|
||||
'OR' for login with Google"""
|
||||
|
|
Loading…
Reference in New Issue