Skip to content

Django request signing using HTTP headers (over SSL)

License

Notifications You must be signed in to change notification settings

jiaaro/resigner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

travis ci

Resigner doc

What it does

Signes API requests: each client is identified by its key and granted access by a secret. (no secret transmitted over to server - used only to sign a request)

How to install

pip install git+git://github.com/mediapredict/resigner.git

Configuration

In settings.py:

INSTALLED_APPS = (
    ...
    'resigner',
    ...
)

Optional

RESIGNER_API_MAX_DELAY = 30 # max delay in seconds (default 5*60 seconds)

Usage (in progress)

Server

from django.http import JsonResponse

from resigner.server import signed_req_required

@signed_req_required
def my_api_view(request):
    resp = {"result": "this API has been protected with secret key"}
    return JsonResponse(resp)

Add through admin:

  • in ApiKeys: MY_API_KEY (key, used to identify a client) and my_secret_key (secret, used to get access)

You may use auto generated or provide specific value.

Client

...
res = post_signed(
    "http://mysite/api_url", {"some": "data_we_want_to_transmit"}, "my_client_key", "my_secret_key"
)

if res.status_code == 200:
    print "went good!"
else:
    print "error HTTP status_code:{0}".format(res.status_code)
...

Make sure MY_API_KEY and MY_TEST_CLIENT have been added in the server's DB as explained above.

About

Django request signing using HTTP headers (over SSL)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%