Skip to main content

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


Download files

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

Source Distribution

cubicweb_signedrequest-3.3.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cubicweb_signedrequest-3.3.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file cubicweb_signedrequest-3.3.1.tar.gz.

File metadata

  • Download URL: cubicweb_signedrequest-3.3.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cubicweb_signedrequest-3.3.1.tar.gz
Algorithm Hash digest
SHA256 c7bed0bcf42e1ef037c8f44241241f448045ee596a57993a24cc69a372f9be2b
MD5 dcba7bbe4167fff3cbea8b84a6dea2cf
BLAKE2b-256 23a4a6506f3aac23853039381cd07607fb6abd623cfda40b31b184a43fee75c7

See more details on using hashes here.

File details

Details for the file cubicweb_signedrequest-3.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cubicweb_signedrequest-3.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db233b5eb679d01f1ab2a416fb954f6f96967c7945476712f6ec0834ee82c62c
MD5 7ddeed8a2ff7f80f9828dc84c71ab2c2
BLAKE2b-256 2fd5c7450ec40404b04014005f8887a18bfcb0b1208125a5e90fd12c82782060

See more details on using hashes here.

Supported by

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