Allows custom event sending of login failures/success to TCell
Project description
tCell Hooks is to be used in conjuction with the tcell_agent to allow for custom event notifications of login failures and login successes.
Getting started
You can add it to your requirements.txt file with:
tcell_hooks
Then run pip install -r requirements.txt
There are two options for calling the hooks from your application code:
By providing a Django/Flask request object and having the tCell Agent extract the relevant details from it:
from tcell_hooks.v1 import send_django_login_event, LOGIN_SUCCESS
send_django_login_event(
status=LOGIN_SUCCESS,
django_request=request,
user_id="tcell@tcell.io",
session_id="124KDJFL3234"
)
from tcell_hooks.v1 import send_flask_login_event, LOGIN_SUCCESS
send_flask_login_event(
status=LOGIN_SUCCESS,
flask_request=request,
user_id="tcell@tcell.io",
session_id="124KDJFL3234"
)
Or by providing each individual piece of information required for the tCell event:
from tcell_hooks.v1 import send_login_event, LOGIN_SUCCESS
send_login_event(
status=LOGIN_SUCCESS,
session_id="124KDJFL3234",
user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) ...",
referrer="http://192.168.99.100:3000/",
remote_address="192.168.99.1",
header_keys=["HOST", "USER_AGENT", "ACCEPT", "REFERER", "ACCEPT_ENCODING", "ACCEPT_LANGUAGE", "COOKIE"],
user_id="tcell@tcell.io",
document_uri="/users/auth/doorkeeper/callbackuri"
)
The available statuses are:
LOGIN_SUCCESS
LOGIN_FAILURE
Important Note
If the tcell_agent is not installed or if it's disabled, this code will do nothing and should have no performance effect on your app.
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.