Helper for spkcspiders domain authentication
Project description
Helper for db based domain auth
Installation
pip install spkcspider-domainauth
settings:
...
INSTALLED_APPS = [
...
spider_domainauth
...
]
DOMAINAUTH_URL = 'spider_domainauth:domainauth-db'
Usage:
url based:
from django.conf import settings
from django.shortcuts import resolve_url
response = requests.post(
resolve_url(settings.DOMAINAUTH_URL),
{
"urls": "http://foo/component/list/"
}
)
token = response.json["tokens"]["foo"]
Module based:
from spider_domainauth.models import ReverseToken
# overloaded create method
rtoken = ReverseToken.objects.create()
"http://foo/token/list/?intent=domain&referrer={referrer}&payload={token}".format(
referrer=resolve_url(settings.DOMAINAUTH_URL),
token=rtoken.token
)
e.refresh_from_db()
# note: it is not token but secret, reason: token is reused and prefixed with id (for uniqueness)
e.secret
Other settings:
- DOMAINAUTH_RATELIMIT_FUNC: ratelimit access tries
- DOMAINAUTH_LIFETIME: token lifetime (default 1 hour) (Note: if "url based"-method is used, the token is automatically deleted afterwards)
TODO:
- overload other manager methods
- better examples
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 Distribution
Built Distribution
Close
Hashes for spkcspider-domainauth-0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f44b6449cd246fba7bc8c8d4537a10a93d9ab712cf0cb8f8b1cd8844140ffe |
|
MD5 | a2d689871150f945355abf80fa110705 |
|
BLAKE2b-256 | 61d41561eab81fe3103f4e19d715ddde8dc98227aafa5f6df4dd554b4973e853 |
Close
Hashes for spkcspider_domainauth-0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 165c0c660af8a425fcdbc7322ca50408de15c8daf9a06635386a61402d9daee3 |
|
MD5 | f184dc0695132d5a4a26ea6d0e53cc9e |
|
BLAKE2b-256 | df5bee365e4a37242b94ea37a54be7698f774d3c613993a387703abc449f9c1d |