Skip to main content

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

  1. Add django_cloudspotlicense to your INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'django_cloudspotlicense'
]
  1. Include the URLConf in your project urls.py
urlpatterns = [
    path('auth/', include('django_cloudspotlicense.urls')),
]
  1. Run python manage.py migrate to create all the required models

  2. 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" />
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-cloudspotlicense-4.1.0.tar.gz (21.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page