rest api for cubicweb
Project description
Summary
This cube allows a client to forge signed HTTP resquests that are then recognized as valid by the CubicWeb web server, ie. the request is handled as an authenticated user. For example, it can be used to start an operation using an authenticated user.
It’s usually used alongside with cubicweb-rqlcontroller and cwclientlib.
This cube aims at make it easy to write REST-like APIs for CW.
Long story short: cubicweb-signedrequest allows you to make authenticated HTTP requests simply by addind a properly forged HTTP header in your request.
How to use signed HTTP requests in your CubicWeb app?
This cube aims at making it possible to use tokens to authenticate to a CubicWeb application. It provides a Token entity that have a unique token_id attribute and a generated (secret) token. This Token entity is related to a CWUser (using the token_for_user relation).
It’s the possible to make authenticated HTTP requests (authenticated as this CWUser) by adding a Authorization header to the HTTP request. This header is computed as a HMAC hash with:
the secret token as key,
the concatenation os method + url + all the signed headers.
By default, the method is the Cubicweb string, and the signed headers are ‘Content-SHA512’, ‘Content-Type’ and ‘Date’.
The doc/sreq_example.py script is an simple python script showing how to forge such a HTTP GET request using urllib2.
Please read the documentation of cwclientlib for examples of how it can be used.
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
Hashes for cubicweb-signedrequest-3.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ff41fee0e58c2a11b10103f2ef0bbb60eab0300764678c0852dcd2704a2920 |
|
MD5 | d9b9afe5d7586805ce6f2a333bfd72ef |
|
BLAKE2b-256 | b02c31f2c4cb326c2d35e82521e395456c7919bac1fc98f6e616fa26fdf7720e |
Hashes for cubicweb_signedrequest-3.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adb54b4981fb160d06d4543771ab64517841e2f89df5fccad693696ef3c1b563 |
|
MD5 | 6c1e4e2b13915684b6ed2709caa41798 |
|
BLAKE2b-256 | 9a7ce6f1fd47e0a45cefa7ae04557dc590b11d352980bde28834649de3ec2d03 |