forked from bearstech/django-authtkt
-
Notifications
You must be signed in to change notification settings - Fork 0
ouinformatics/django-authtkt
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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)
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%