Django package to integrate the authentication of the Cloudspot License Server in other django applications
Project description
django-cloudspotlicense
Django package to integrate the authentication of the Cloudspot License Server in other django applications.
Getting started
Install
Install with pip.
pip install django-cloudspotlicense
Quick start
- Add
django_cloudspotlicense
to your INSTALLED_APPS
INSTALLED_APPS = [
...
'django_cloudspotlicense'
]
- Include the URLConf in your project urls.py
urlpatterns = [
path('auth/', include('django_cloudspotlicense.urls')),
]
-
Run
python manage.py migrate
to create all the required models -
Use the
LoginView
to let users log in using the Cloudspot License Server
import django_cloudspotlicense.views as auth_views
urlpatterns = [
path('login', auth_views.LoginView.as_view(), name='login')
]
A basic html template with no styling will be provided. You can overwrite this template by simply creating a new template at templates/auth/login.html
.
The only requirement for this template is that it includes two input elements with the name username
and password
.
<input type="text" name="username" />
<input type="password" name="password" />
- Done
Setting up the User model
You can extend the User model as usual to add more attributes. django_cloudspotlicense
also uses the User model to store additional information, such as tokens and the company id.
If you want to add additional attributes, import the User class from the package and add your attributes as usual.
from django_cloudspotlicense.models import CloudspotUser
class User(CloudspotUser):
extra_data = models.CharField(max_length=500, default='foobar')
Use as normal.
print(user.extra_data) # foobar
Webhook
This package also provides a webhook where the Cloudspot License Server will send updates to whenever the permissions for a user changes.
The webhook is located at https://example.com/auth/webhook
. This webhook is automatically activated when importing the URLConf.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-cloudspotlicense-4.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d122be865d897bc361725e186321b4e3a319b7a6a0c76bfecba457d320085a |
|
MD5 | 4a6290929bc53fa386bf0546db6c4be8 |
|
BLAKE2b-256 | 3b157f82028c1ed17390b296fae9a61b1368f7d9d690a2d55794498e774a0e32 |