mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
This commit builds a more complete concept of an "external authentication method". Our social backends become a special case of an external authentication method - but these changes don't change the actual behavior of social backends, they allow having other backends (that come from python-social-auth and don't use the social backend pipeline) share useful code that so far only serviced social backends. Most importantly, this allows having other backends show up in the external_authentication_methods field of the /server_settings endpoint, as well as rendering buttons through the same mechanism as we already did for social backends. This moves the creation of dictonaries describing the backend for the API and button rendering code away into a method, that each backend in this category is responsible for defining. To register a backend as an external_authentication_method, it should subclass ExternalAuthMethod and define its dict_representation classmethod, and finally use the external_auth_method class decorator to get added to the EXTERNAL_AUTH_METHODS list.