mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 07:56:44 -06:00
#10135 add idp to saml login
This commit is contained in:
parent
12354ae5c6
commit
741b7f8ffc
@ -42,7 +42,7 @@
|
||||
{% if auth_backends %}
|
||||
<h6 class="mt-4 mb-3">Or use a single sign-on (SSO) provider:</h6>
|
||||
{% for name, backend in auth_backends.items %}
|
||||
{% if name == 'saml' %}
|
||||
{% if name == 'saml' and backend.idps %}
|
||||
{% for idp in backend.idps %}
|
||||
<h5>
|
||||
{% if backend.icon_name %}<i class="mdi mdi-{{ backend.icon_name }}"></i>{% endif %}
|
||||
|
@ -17,7 +17,7 @@ from social_core.backends.utils import load_backends
|
||||
|
||||
from extras.models import ObjectChange
|
||||
from extras.tables import ObjectChangeTable
|
||||
from netbox.authentication import get_auth_backend_display
|
||||
from netbox.authentication import get_auth_backend_display, get_saml_idps
|
||||
from netbox.config import get_config
|
||||
from utilities.forms import ConfirmationForm
|
||||
from .forms import LoginForm, PasswordChangeForm, TokenForm, UserConfigForm
|
||||
@ -46,9 +46,18 @@ class LoginView(View):
|
||||
logger = logging.getLogger('netbox.auth.login')
|
||||
return self.redirect_to_next(request, logger)
|
||||
|
||||
auth_backends = {
|
||||
name: get_auth_backend_display(name) for name in load_backends(settings.AUTHENTICATION_BACKENDS).keys()
|
||||
}
|
||||
auth_backends = {}
|
||||
for name in load_backends(settings.AUTHENTICATION_BACKENDS).keys():
|
||||
display_name, icon_name = get_auth_backend_display(name)
|
||||
data = {
|
||||
'display_name': display_name,
|
||||
'icon_name': icon_name,
|
||||
}
|
||||
|
||||
if name == 'saml':
|
||||
data['idps'] = get_saml_idps()
|
||||
|
||||
auth_backend[name] = data
|
||||
|
||||
return render(request, self.template_name, {
|
||||
'form': form,
|
||||
|
Loading…
Reference in New Issue
Block a user