auth: Automate social auth backends in AUTH_BACKEND_NAME_MAP.

This saves a line of manual code every time we add a new social auth
backend.
This commit is contained in:
Tim Abbott 2018-10-11 16:58:01 -07:00
parent fd4c23e12d
commit 1244a5077e
1 changed files with 4 additions and 1 deletions

View File

@ -629,8 +629,11 @@ class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2):
AUTH_BACKEND_NAME_MAP = { AUTH_BACKEND_NAME_MAP = {
'Dev': DevAuthBackend, 'Dev': DevAuthBackend,
'Email': EmailAuthBackend, 'Email': EmailAuthBackend,
'GitHub': GitHubAuthBackend,
'Google': GoogleMobileOauth2Backend, 'Google': GoogleMobileOauth2Backend,
'LDAP': ZulipLDAPAuthBackend, 'LDAP': ZulipLDAPAuthBackend,
'RemoteUser': ZulipRemoteUserBackend, 'RemoteUser': ZulipRemoteUserBackend,
} # type: Dict[str, Any] } # type: Dict[str, Any]
# Authomatically add all of our social auth backends to relevant data structures.
for social_auth_subclass in SocialAuthMixin.__subclasses__():
AUTH_BACKEND_NAME_MAP[social_auth_subclass.auth_backend_name] = social_auth_subclass