Skip to content

Commit

Permalink
update imports to support Netbox v4.0 (#79)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ProbstenHias authored May 22, 2024
1 parent 24e3bd9 commit e486b12
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ the User to the SSO system. Please refer to the example [nginx.conf](nginx.conf

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

*NOTE: Netbox plugin for SSO, v3.0+, supports Netbox 4.0.

## System Requirements

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

2 changes: 1 addition & 1 deletion django3_saml2_nbplugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
this plugin is invoked the settings is already configured, and if you try
settings.configure(SAML2_AUTH_CONFIG=user_config) an exception will be raised.
"""
from extras.plugins import PluginConfig
from netbox.plugins import PluginConfig
from django3_auth_saml2.config import SAML2_AUTH_CONFIG


Expand Down
5 changes: 3 additions & 2 deletions django3_saml2_nbplugin/backends.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Optional
from django.contrib.auth.models import User, Group
from django.core.handlers.wsgi import WSGIRequest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.handlers.wsgi import WSGIRequest
from netbox.authentication import Group
from saml2.response import AuthnResponse

# Subclass from the Netbox provided RemoteUserBackend so that we get the
Expand Down

0 comments on commit e486b12

Please sign in to comment.