Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Django kerberos authentication backend

Project description

Django kerberos authentication backend.

Install

# install via pip
pip install django-auth-krb
# or install from source
python setup.py install

Usage

RemoteKrbBackend

Make sure following settings are configured in settings.py:

INSTALLED_APPS = (
    ...
    'django_auth_krb',
    ...
)

KRB5_REALM = 'EXAMPLE.COM'

AUTHENTICATION_BACKENDS = (
   'django_auth_krb.backends.RemoteKrbBackend',
)

MIDDLEWARE = [
    ...
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.auth.middleware.PersistentRemoteUserMiddleware',
    ...
]

LOGIN_REDIRECT_URL = '/'

Include auth url in project urls.py

from django.conf.urls include

urlpatterns = [
    url(r'^auth/', include('django_auth_krb.urls')),
    ...
]

Config apache as follow if you want to use RemoteKrbBackend:

<VirtualHost *:443>
    ServerAdmin webmaster@host.example.com
    ServerName host.example.com

    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key

    WSGIScriptAlias / /path/to/django/project/wsgi.py
    WSGIPassAuthorization On

    <Location "/">
        Require all granted
    </Location>

    <Location "/auth/login/">
        SSLRequireSSL
        AuthType Kerberos
        AuthName "Kerberos login"
        KrbMethodNegotiate on
        KrbMethodK5Passwd off
        KrbServiceName HTTP
        KrbAuthRealm EXAMPLE.COM
        Krb5Keytab /etc/httpd/conf/httpd.keytab
        KrbSaveCredentials off
        KrbVerifyKDC on
        Require valid-user
    </Location>
</VirtualHost>

Enable login/logout view in url.py:

from django.conf.urls import include

urlpatterns = patterns('',
    ...
    url(r'^auth/', include('django_auth_krb.urls')),
    ...
)

Project details


Release history Release notifications

This version
History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django_auth_krb-0.2.0.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None Nov 4, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page