Skip to main content

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


Download files

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

Source Distribution

tcell_hooks-1.1.0.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file tcell_hooks-1.1.0.tar.gz.

File metadata

  • Download URL: tcell_hooks-1.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for tcell_hooks-1.1.0.tar.gz
Algorithm Hash digest
SHA256 77bc9fb93211c2a310289afc291aad4661c9680dd162c4e4720a8dfe70ee5370
MD5 729033f3eddbc23da4084a81c7adddad
BLAKE2b-256 d8d1c4dc96d33ab95c5998c9c900351379831ad5430716b53c773595b8d7b8e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page