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
from django.shortcuts import resolve_url
# 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
Settings:
- DOMAINAUTH_RATELIMIT_FUNC: ratelimit access tries, can be also used to limit number of tokens
- DOMAINAUTH_LIFETIME: token lifetime (default 1 hour) (Note: if "url based"-method is used, the token is automatically deleted afterwards)
- DOMAINAUTH_URL: url to domain auth view (required for external users)
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.6.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c5bc07a792ad71cf7e6e0462cfd7c4b23b3b3f3e5fadd55ab98538ac2fb879f |
|
MD5 | e5a05f74898c6c92f6fe51e98e51923c |
|
BLAKE2b-256 | 87a635c65d55ea3451282ae2babbb83ff61e5e2601115fee5f8572c67b2e0954 |
Close
Hashes for spkcspider_domainauth-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0ffe59e0b9a7bbb0c3c5dcc1342e2235bae97dd64d9cb91c3f2944eac3c4f85 |
|
MD5 | b684f12badd7d0dc2c08895241e35363 |
|
BLAKE2b-256 | 134bf74c8af4be4759bb50b36ff347e4c29e97aa1de25a99a5f56780707f68e2 |