Skip to main content
# django-auth-pubtkt

Author: Alexander Vyushkov

Implementation of mod_auth_pubtkt: a pragmatic Web Single Sign-On (SSO) solution as Django middleware.
This version was tested on Python == 2.7, Django == 1.11

It is incompatible with previous versions (use django-auth-pubtkt==1.1.2 for Django 1.5)

Please refer to https://neon1.net/mod_auth_pubtkt/index.html for additional details.

# Installation from GitHub

```bash
pip install git+git://github.com/Baguage/django-auth-pubtkt@master#egg=django-auth-pubtkt
```

# Installation:

django-auth-pubtkt uses M2Crypto library. Installation instructions for
different platforms are below.
When M2Crypto is installed, django-auth-pubtkt can be installed using pip
pip install django-auth-pubtkt
or using setuptools
./setup.py install

# Windows

Use binary package available on http://chandlerproject.org/Projects/MeTooCrypto#Downloads

# RedHat 7 + Python 3.5

I got "Failed building wheel for m2crypto" when used "pip install m2crypto" command.
The library was installed successfully, and all tests passed, somehow.

# CentOS 6/RedHat 6/Fedora

Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.

pip install --download=/tmp M2Crypto==0.21.1
cd /tmp
tar -zxf /tmp/M2Crypto-0.21.1.tar.gz
cd M2Crypto-0.21.1
./fedora_setup.sh install
python setup.py test

Note that setup.py test is required in some cases to fix "ImportError: No module named __m2crypto" error.
lease refer to http://stackoverflow.com/questions/4773659/cant-install-a-python-package for additional details

CentOS 7/RedHat 7 should be fine

# Configuration

Add 'django_auth_pubtkt.middleware.DjangoAuthPubtkt' to MIDDLEWARE (Django 1.11+)

* Change LOGIN_URL to "/sso/"
* Set TKT_AUTH_LOGIN_URL to the address of SSO login page
* Add piece of code below to urls.py

```python
from django.conf.urls import url
from django_auth_pubtkt.views import redirect_to_sso

urlpatterns = [
# ...
url('^sso/', redirect_to_sso),
# ...
]
```

OR

Change LOGIN_URL to the address of SSO login page.
Configure your SSO to use 'next' as redirect field name.

OR

use @method_decorator(login_required(redirect_field_name="back"))

# Configuration variables (settings.py)

```
TKT_AUTH_PUBLIC_KEY
Default: None
Filename of DSA public key in .pem format. It is used to verify ticket signature.

TKT_AUTH_COOKIE_NAME
Default: "auth_pubtkt"
Name of the authentication cookie to use.

TKT_AUTH_USE_GROUPS
Default: False
Treat tokens as group names. Create groups if they don't exist yet.

TKT_AUTH_LOGIN_URL
Default: None
URL that users without a valid ticket will be redirected to

TKT_AUTH_BACK_ARG_NAME
Default: "back"
Name of the GET argument with the originally requested URL (when redirecting to the login page)

TKT_AUTH_ANONYMOUS_USER
Default: True
Add AnonymousUser object if no auth_pubtkt cookie is found. If set, django_auth_pubtkt can be used as a replacement to AuthenticationMiddleware.
If disabled, AuthenticationMiddleware and django_auth_pubtkt can be used together.
```

Metadata

Release files for django-auth-pubtkt 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-auth-pubtkt 2.0.1
File Size Uploaded Provenance Actions
django-auth-pubtkt-2.0.1.tar.gz 7.7 kB Without provenance Details for django-auth-pubtkt-2.0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for django-auth-pubtkt 2.0.1
File Interpreter ABI Platform Actions
django_auth_pubtkt-2.0.1-py2.7.egg Legacy Egg format - - Details for django_auth_pubtkt-2.0.1-py2.7.egg
django-auth-pubtkt-2.0.1.win-amd64.exe Details for django-auth-pubtkt-2.0.1.win-amd64.exe

Total release size: 265.7 kB

Release files / django-auth-pubtkt-2.0.1.tar.gz

Download URL django-auth-pubtkt-2.0.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2dcab9af2f097bd8c37b6ad0c2ff044378fc860a33835c7e40f1c065eed6a614
BLAKE2b-256 checksum
How to use checksums
1887b1ef97a4c8d1d79003cccab2e796ffd51d65fbe02700b72b5f5b5679f000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_auth_pubtkt-2.0.1-py2.7.egg

Download URL django_auth_pubtkt-2.0.1-py2.7.egg
Size 19.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
65dcfbc109b1ec95735d31f92598d7c82abe8afbec7de6228167af3fc8cd874b
BLAKE2b-256 checksum
How to use checksums
edecc81fa3dfe074bb8df778c09dc0eedfbeddc382276a0eec3bd2a227c1a8a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django-auth-pubtkt-2.0.1.win-amd64.exe

Download URL django-auth-pubtkt-2.0.1.win-amd64.exe
Size 239.0 kB
Tags Source
SHA-256 checksum
How to use checksums
61690269b306e26bda27ae8f101963b18eb84af073fc3e63f6e4fea0a54b71f6
BLAKE2b-256 checksum
How to use checksums
2a16e8ed8cfb4214934b2c03dbb4d57ba2f1d6e7ed19138253395a96436bd6bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-auth-pubtkt 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page