django-authtkt is used to share auth between more than one django site (a kind of SSO auth)
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
django-authtkt-0.2.zip
(11.2 kB
view details)
django-authtkt-0.2.tar.gz
(6.0 kB
view details)
File details
Details for the file django-authtkt-0.2.zip.
File metadata
- Download URL: django-authtkt-0.2.zip
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
807e9fd230d9c96e00b394b5c40c2c6c3cae0d521fff1801a11c3b7724d11e4a
|
|
| MD5 |
dde850216e9b54e9a21aef6550d9beed
|
|
| BLAKE2b-256 |
19c3797fed118627091104d9f8e7955c34d6dc32edc09bb65c1c60b98d792d62
|
File details
Details for the file django-authtkt-0.2.tar.gz.
File metadata
- Download URL: django-authtkt-0.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caf7da1abb7c118416bbd5b121a8726c8f060f6f87d31f8956f6548e4b0a93d8
|
|
| MD5 |
1cc32d60f70fd86c7ea4754f45faff4d
|
|
| BLAKE2b-256 |
abba260d3ba9e78de2bb625649c4701fff86d2103faf3b81eea611ea44288886
|