Skip to content

Commit e486b12

Browse files
authored
update imports to support Netbox v4.0 (#79)
According to the netbox docs `extras.plugins` was renamed to `netbox.plugins`. Furthermore netbox no longer uses `django.contib.auth.models` to handle groups but `netbox.authentication`. These changes will make the plugin uncompatible with netbox versions before v4.0
1 parent 24e3bd9 commit e486b12

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ the User to the SSO system. Please refer to the example [nginx.conf](nginx.conf
1313

1414
*NOTE: Netbox plugin for SSO, v2.0+, supports Netbox 2.8, 2.9, 2.10, 2.11, 3.0.
1515

16+
*NOTE: Netbox plugin for SSO, v3.0+, supports Netbox 4.0.
17+
1618
## System Requirements
1719

1820
You will need to install the [django3-auth-saml2](https://github.com/jeremyschulman/django3-auth-saml2)
@@ -140,4 +142,3 @@ Add the following to your configuration.py:
140142
```python
141143
BANNER_LOGIN = '<a href="/api/plugins/sso/login" class="btn btn-primary btn-block">Login with SSO</a>'
142144
```
143-

django3_saml2_nbplugin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
this plugin is invoked the settings is already configured, and if you try
99
settings.configure(SAML2_AUTH_CONFIG=user_config) an exception will be raised.
1010
"""
11-
from extras.plugins import PluginConfig
11+
from netbox.plugins import PluginConfig
1212
from django3_auth_saml2.config import SAML2_AUTH_CONFIG
1313

1414

django3_saml2_nbplugin/backends.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from typing import Optional
2-
from django.contrib.auth.models import User, Group
3-
from django.core.handlers.wsgi import WSGIRequest
42
from django.conf import settings
3+
from django.contrib.auth.models import User
4+
from django.core.handlers.wsgi import WSGIRequest
5+
from netbox.authentication import Group
56
from saml2.response import AuthnResponse
67

78
# Subclass from the Netbox provided RemoteUserBackend so that we get the

0 commit comments

Comments
 (0)