This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

django-tequila

Tequila authentication for django.

Requirements

django-tequila needs a modern version of Django – something after 1.8. We aim to follow the last LTS, and we try as we can to follow the versions between LTS.

Latest known functioning version : 1.10.

If you use Django pre 1.6, see django-tequila 1.9.x.

This project also expects a fully operational Tequila server.

Installation

pip install django-tequila

Configuration

You can find an django app example in ./django-tequila/sample_app or run the full setup with

docker-compose up

settings.py

  • Add at the end of your MIDDLEWARE_CLASSES:

    'django_tequila.middleware.TequilaMiddleware',
    
  • Add to INSTALLED_APPS:

    'django_tequila',
    
  • Add the line:

    AUTHENTICATION_BACKENDS = ('django_tequila.django_backend.TequilaBackend',)
    
  • Set a name that will be displayed on the tequila login page:

    TEQUILA_SERVICE_NAME = "django_tequila_service"
    
  • Finally, add:

        LOGIN_URL = "/login"
        LOGIN_REDIRECT_URL = "/"
        LOGIN_REDIRECT_IF_NOT_ALLOWED = "/not_allowed"
    LOGOUT_URL = '/'
    

urls.py

  • Add these lines:

    from django_tequila.urls import urlpatterns as django_tequila_urlpatterns
    
    urlpatterns += django_tequila_urlpatterns
    

Profile customization

You may want to keep some additional informations about the user. Take a look at this page for more informations about profile customization.

Here is an example for a profile for Django 1.1+. With Django 1.5+, you may advise to use this way.

  • Create a profile in your models.py, like this:

    from django.contrib.auth.models import User
    from django.db import models
    
    class UserProfile(models.Model):
        #required field
    user = models.OneToOneField(User, related_name="profile")
    
        sciper = models.PositiveIntegerField(null=True, blank=True)
        where = models.CharField(max_length=100, null=True, blank=True)
        units = models.CharField(max_length=300, null=True, blank=True)
        group = models.CharField(max_length=150, null=True, blank=True)
        classe = models.CharField(max_length=100, null=True, blank=True)
        statut = models.CharField(max_length=100, null=True, blank=True)
    
    # Trigger for creating a profile on user creation
    def user_post_save(sender, instance, **kwargs):
        profile, new = UserProfile.objects.get_or_create(user=instance)
    
    # Register the trigger
    models.signals.post_save.connect(user_post_save, sender=User)
    
  • in your settings.py, tell django to use your model:

    AUTH_PROFILE_MODULE = "my_app.userprofile"
    
  • Update your database:

    ./manage.py syncdb
    

Site Admin customizations

If you want to use the admin site, be sure you have followed all steps to have a working django admin site, then follow these steps :

  • Modify your urls.py to look like this:

    from django.contrib import admin
    from django_tequila.admin import TequilaAdminSite
    admin.autodiscover()
    admin.site.__class__ = TequilaAdminSite
    
  • Please note that your username should identical to the one you use to login in Tequila. If you do not have any user at the moment, or you want to edit some of them, create a superuser with this command (replace <USERNAME> and <EMAIL> with you Tequila username and email):

    python manage.py createsuperuser --username=<USERNAME> --email=<EMAIL>
    

Additional tips and settings

Advanced settings

  • If you need to use your personal server, change this parameter:

    TEQUILA_SERVER_URL = "https://tequila.epfl.ch"
    
  • You may want to create an inactive user when someone try to connect to your app. So you can manually control who access it. If this is the case, add this line to settings.py:

    TEQUILA_NEW_USER_INACTIVE = True
    
  • You may want to add some custom allow with Tequila. If this is the case, add this line to settings.py:

    TEQUILA_CONFIG_ALLOW = 'categorie=shibboleth'
    

    or, for multiple allow :

    TEQUILA_CONFIG_ALLOW = ‘categorie=shibboleth|categorie=epfl-old’

  • You may want to add some custom paramaters with Tequila. If this is the case, add this line to settings.py:

    TEQUILA_CONFIG_ADDITIONAL = {'allowedorgs': 'EPFL, UNIL'}
    
  • Everytime the user connect trought the Tequila process, he is redirected to an url that has a ‘key’ paramter. For some esthetic reasons,you may want to remove this parameter, so add this line to settings.py:

    TEQUILA_CLEAN_URL = True
    

    As it creates a redirect to the cleaned address and add an additional page hit, The value by default is False

  • You can force a strong authentication so add this line to settings.py:

    TEQUILA_STRONG_AUTHENTICATION = True
    

    Default value is False

Logging

Sometimes we struggle to get the aimed result, showing some log may help :

  • Add and customize as you need this logger to your settings

    'django_tequila': {
            'handlers': ['console'],
            'level': 'DEBUG',
        },
    
Release History

Release History

2.1.7

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-tequila-2.1.7.tar.gz (20.5 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting