auth: Add auth_name attribute for non external auth backends.

This commit adds `name` attribute for the backends that do not
have them.

This is just a kind of prep commit in case if we want to use
`self.logger.xxxx()` in the future which is dependent on the
`name` attribute. But right now these logging calls aren't used
anywhere in those backends.
This commit is contained in:
Dinesh 2020-06-03 16:48:08 +05:30 committed by Tim Abbott
parent e22ca9483e
commit 04671f40ae
1 changed files with 6 additions and 0 deletions

View File

@ -303,6 +303,8 @@ class EmailAuthBackend(ZulipAuthMixin):
Allows a user to sign in using an email/password pair.
"""
name = 'email'
@rate_limit_auth
def authenticate(self, request: Optional[HttpRequest]=None, *,
username: str, password: str,
@ -398,6 +400,8 @@ class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend):
file makes the flow for LDAP authentication clear.
"""
name = "ldap"
def __init__(self) -> None:
# Used to initialize a fake LDAP directly for both manual
# and automated testing in a development environment where
@ -871,6 +875,8 @@ class DevAuthBackend(ZulipAuthMixin):
"""Allow logging in as any user without a password. This is used for
convenience when developing Zulip, and is disabled in production."""
name = 'dev'
def authenticate(self, request: Optional[HttpRequest]=None, *,
dev_auth_username: str, realm: Realm,
return_data: Optional[Dict[str, Any]]=None) -> Optional[UserProfile]: