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.
.. Warning:: cubicweb-signedrequest_ is **very** ticklish about time:
your request will be refused is the ``Date`` header if
not very accurate. Also, for security reasons, you won't
have any detail on why your request has been denied.
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.
.. _cubicweb-rqlcontroller: https://www.cubicweb.org/project/cubicweb-rqlcontroller
.. _cubicweb-signedrequest: https://www.cubicweb.org/project/cubicweb-signedrequest
.. _cwclientlib: https://www.cubicweb.org/project/cwclientlib
Raw data
{
"_id": null,
"home_page": "https://forge.extranet.logilab.fr/cubicweb/cubes/cubicweb-signedrequest",
"name": "cubicweb-signedrequest",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9.2",
"maintainer_email": null,
"keywords": null,
"author": "LOGILAB S.A. (Paris, FRANCE)",
"author_email": "contact@logilab.fr",
"download_url": "https://files.pythonhosted.org/packages/a5/fd/2181d957365a42b3a65899d46c35333a580cfc0ed6595f2b93697bcfa1ee/cubicweb_signedrequest-3.2.0.tar.gz",
"platform": null,
"description": "Summary\n-------\n\nThis cube allows a client to forge signed HTTP resquests that are then\nrecognized as valid by the CubicWeb web server, ie. the request is\nhandled as an authenticated user. For example, it can be used to start\nan operation using an authenticated user.\n\nIt's usually used alongside with cubicweb-rqlcontroller_ and\ncwclientlib_.\n\nThis cube aims at make it easy to write REST-like APIs for CW.\n\nLong story short: cubicweb-signedrequest_ allows you to make\nauthenticated HTTP requests simply by addind a properly forged HTTP\nheader in your request.\n\n.. Warning:: cubicweb-signedrequest_ is **very** ticklish about time:\n your request will be refused is the ``Date`` header if\n not very accurate. Also, for security reasons, you won't\n have any detail on why your request has been denied.\n\n\nHow to use signed HTTP requests in your CubicWeb app?\n-----------------------------------------------------\n\nThis cube aims at making it possible to use tokens to authenticate to\na CubicWeb application. It provides a Token entity that have a unique\n``token_id`` attribute and a generated (secret) token. This `Token`\nentity is related to a ``CWUser`` (using the `token_for_user`\nrelation).\n\nIt's the possible to make authenticated HTTP requests (authenticated\nas this CWUser) by adding a `Authorization` header to the HTTP\nrequest. This header is computed as a HMAC hash with:\n\n - the secret token as key,\n\n - the concatenation os `method` + `url` + all the signed headers.\n\n\nBy default, the `method` is the `Cubicweb` string, and the signed\nheaders are 'Content-SHA512', 'Content-Type' and 'Date'.\n\nThe `doc/sreq_example.py` script is an simple python script showing how to\nforge such a HTTP GET request using `urllib2`.\n\nPlease read the documentation of cwclientlib_ for examples of how it\ncan be used.\n\n.. _cubicweb-rqlcontroller: https://www.cubicweb.org/project/cubicweb-rqlcontroller\n.. _cubicweb-signedrequest: https://www.cubicweb.org/project/cubicweb-signedrequest\n.. _cwclientlib: https://www.cubicweb.org/project/cwclientlib\n",
"bugtrack_url": null,
"license": "LGPL",
"summary": "REST API for CubicWeb",
"version": "3.2.0",
"project_urls": {
"Homepage": "https://forge.extranet.logilab.fr/cubicweb/cubes/cubicweb-signedrequest"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cbfbf1050db178937bc8d2ead4884720e254b6ff6d5239f054133da7ddf66088",
"md5": "b275bba2ce50c1eefdb4d44f5be38226",
"sha256": "82223f3eed5ac6f3a16e29e824f0651be4590b7bf27531940cb0560f3b4b15cf"
},
"downloads": -1,
"filename": "cubicweb_signedrequest-3.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b275bba2ce50c1eefdb4d44f5be38226",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9.2",
"size": 21124,
"upload_time": "2025-01-24T12:47:22",
"upload_time_iso_8601": "2025-01-24T12:47:22.616013Z",
"url": "https://files.pythonhosted.org/packages/cb/fb/f1050db178937bc8d2ead4884720e254b6ff6d5239f054133da7ddf66088/cubicweb_signedrequest-3.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a5fd2181d957365a42b3a65899d46c35333a580cfc0ed6595f2b93697bcfa1ee",
"md5": "3941f21d1e764aef86e551f24e609245",
"sha256": "732f83be999dec499ffc0a2e6f6056bb3ba6f3ab2cd6a7d8627f4b6e28e3ab48"
},
"downloads": -1,
"filename": "cubicweb_signedrequest-3.2.0.tar.gz",
"has_sig": false,
"md5_digest": "3941f21d1e764aef86e551f24e609245",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9.2",
"size": 19530,
"upload_time": "2025-01-24T12:47:24",
"upload_time_iso_8601": "2025-01-24T12:47:24.534964Z",
"url": "https://files.pythonhosted.org/packages/a5/fd/2181d957365a42b3a65899d46c35333a580cfc0ed6595f2b93697bcfa1ee/cubicweb_signedrequest-3.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-24 12:47:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "cubicweb-signedrequest"
}