diff --git a/netbox/netbox/authentication.py b/netbox/netbox/authentication.py index 62512943e..b1f4858c7 100644 --- a/netbox/netbox/authentication.py +++ b/netbox/netbox/authentication.py @@ -55,6 +55,10 @@ def get_auth_backend_display(name): return AUTH_BACKEND_ATTRS.get(name, (name, None)) +def get_saml_idps(): + return getattr(settings, "SOCIAL_AUTH_SAML_ENABLED_IDPS", {}).keys() + + class ObjectPermissionMixin: def get_all_permissions(self, user_obj, obj=None): diff --git a/netbox/templates/login.html b/netbox/templates/login.html index f4dd9c696..b4b0df8d9 100644 --- a/netbox/templates/login.html +++ b/netbox/templates/login.html @@ -41,11 +41,20 @@ {% if auth_backends %}
Or use a single sign-on (SSO) provider:
- {% for name, display in auth_backends.items %} -
- {% if display.1 %}{% endif %} - {{ display.0 }} -
+ {% for name, backend in auth_backends.items %} + {% if name == 'saml' %} + {% for idp in backend.idps %} +
+ {% if backend.icon_name %}{% endif %} + {{ backend.display_name }} ({{idp}}) +
+ {% endfor %} + {% else %} +
+ {% if backend.icon_name %}{% endif %} + {{ backend.display_name }} +
+ {% endif %} {% endfor %} {% endif %}