Skip to main content

Usage

Add the middlware class before the AuthenticationMiddleware:

MIDDLEWARE_CLASSES = (
    ...
    'authtkt.middleware.AuthTktMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    ...
)

Callback

You can use a callback to use something to fill the newly created user in the third party app.

Settings:

AUTHTKT_CALLBACK = 'yourmodule:update_user'

Callback:

from sqlalchemy import engine_from_config, Table, MetaData
from django.conf import settings


def update_user(user):
    engine = engine_from_config({'sqlalchemy.url': settings.USER_DB})
    metadata = MetaData(engine)
    users = Table('auth_user', metadata, autoload=True)
    record = users.select(users.c.id==user.id).execute().fetchone()
    for k, v in record.items():
        setattr(user, str(k), v)

Manual identify/forget user

Manualy identify user (eg: set a cookie). You need to set a correct request.user:

request.environ['authtkt.identify'](request, response)

Manualy forget user (eg: reset a cookie):

request.environ['authtkt.forget'](request, response)

Release files for django-authtkt 0.3

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

Source distributions (sdists)

Source distribution for django-authtkt 0.3
File Size Uploaded
django-authtkt-0.3.zip 11.4 kB Details
django-authtkt-0.3.tar.gz 6.0 kB Details

Release files / django-authtkt-0.3.zip

Download URL django-authtkt-0.3.zip
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ab533760edaed7ff93ee0e036845135eb86bab46a60ae6bef363cf95ef9fcf6c
BLAKE2b-256 checksum
How to use checksums
60820ea4ac751d760a1d22eff86e85e58dbe491ed585d9bcf92ec9a13933406f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django-authtkt-0.3.tar.gz

Download URL django-authtkt-0.3.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
339c30ff5da1500784e173c1cc15894e03d2e0270ddcf339ba7ca90ea6d4d652
BLAKE2b-256 checksum
How to use checksums
acc83736057656386b35f04f255cf384ba321c063317e971c605accb1063df26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

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