cone.tokens


Namecone.tokens JSON
Version 0.4 PyPI version JSON
download
home_pagehttp://github.com/conestack/cone.tokens
Summarycone token api
upload_time2024-02-12 10:17:34
maintainer
docs_urlNone
authorCone Contributors
requires_python
licenseMIT
keywords node pyramid cone web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/pypi/v/cone.tokens.svg
    :target: https://pypi.python.org/pypi/cone.tokens
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/dm/cone.tokens.svg
    :target: https://pypi.python.org/pypi/cone.tokens
    :alt: Number of PyPI downloads

.. image:: https://github.com/conestack/cone.tokens/actions/workflows/python-package.yml/badge.svg
    :target: https://github.com/conestack/cone.tokens/actions/workflows/python-package.yml
    :alt: Package build

.. image:: https://coveralls.io/repos/github/bluedynamics/cone.tokens/badge.svg?branch=master
    :target: https://coveralls.io/github/bluedynamics/cone.tokens?branch=master

This package provides a unique token generator for ``cone.app``.

Features:

* QR Code generation
* JSON API for token management


Application ini file configuration
==================================

- **cone.tokens.config_file**: Required. Path to tokens json config file.

- **cone.tokens.settings_node_path**: Optional. Application node path to token settings node.

- **cone.tokens.entryfactory**: Optional. Node class used as entry node factory.


JSON API
========

``cone.tokens`` provides a JSON API for token management.


query_token
-----------

Query token by value. It expects a ``GET`` request.

**Schema**: URL/tokens/query_token

**Params**

- ``value``: A string containing the token value to look up.

**Response**

- ``success``: True or False.
- ``token``: Token data or null if token not exists.
- ``message``: On failure the error message is returned.


add_token
---------

``add_token`` is for generating a new token. It expects a ``POST`` request.

**Schema**: URL/tokens/add_token

**Params**

- ``value``: A string containing the token value. If empty, the token uuid gets used as value.
- ``valid_from``: A datetime in isoformat. If empty, token has no effective date.
- ``valid_to``: A datetime in isoformat. If empty, token has no expiration date.
- ``usage_count``: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times.
- ``lock_time``: Time in seconds the token is locked after consumption as integer.

**Response**

- ``success``: True or False.
- ``token_uid``: On success the token uid is returned.
- ``message``: On failure the error message is returned.


consume_token
-------------

``consume_token`` is for consuming a token. It expects a ``GET`` request.

**Schema**: URL/tokens/<UUID>/consume_token

**Params**

- No parametes expected.

**Response**

- ``success``: True or False.
- ``consumed``: On success flag whether token consumption was valid.
- ``message``: On failure the error message is returned.


update_token
------------

``edit_token`` is for editing a token. It expects a ``POST`` request.

**Schema**: URL/tokens/<UUID>/update_token

**Params**

- ``value``: A string containing the token value. If empty, the token uuid gets used as value. Unchanged if parameter is omitted.
- ``valid_from``: A datetime in isoformat. If empty, token has no effective date. Unchanged if parameter is omitted.
- ``valid_to``: A datetime in isoformat. If empty, token has no expiration date. Unchanged if parameter is omitted.
- ``usage_count``: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times. Unchanged if parameter is omitted.
- ``lock_time``: Time in seconds the token is locked after consumption as integer. Unchanged if parameter is omitted.

**Response**

- ``success``: True or False.
- ``message``: On failure the error message is returned.


delete_token
------------

``delete_token`` is for deleting a token. It expects a ``POST`` request.

**Schema**: URL/tokens/<UUID>/delete_token

**Params**

- No parametes expected.

**Response**

- ``success``: True or False.
- ``message``: On failure the error message is returned.


TODO
====

- Introduce ``consume`` permission for JSON API.


Contributors
============

- Robert Niederreiter
- Torben Baumgartner
- Lena Daxenbichler


Changes
=======

0.4 (2024-02-12)
----------------

- Adopt Settings UI changes from ``cone.app``.
  [rnix]


0.3 (2023-09-28)
----------------

- Tokens can be bulk deleted.
  [lenadax]

- Tokens can be created from scanned value.
  [rnix]


0.2 (2023-09-27)
----------------

- Actually upload package to pypi.
  [rnix]


0.1 (2023-09-27)
----------------

- Initial work.
  [rnix, toalba, lenadax]


License
=======

MIT License

Copyright (c) 2023-2024, Cone Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/conestack/cone.tokens",
    "name": "cone.tokens",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "node pyramid cone web",
    "author": "Cone Contributors",
    "author_email": "dev@conestack.org",
    "download_url": "https://files.pythonhosted.org/packages/26/75/6ae9331d298c33ec99fc1a4a95639133836a729d4df7a37f3a85bf0f9645/cone.tokens-0.4.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/cone.tokens.svg\n    :target: https://pypi.python.org/pypi/cone.tokens\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/dm/cone.tokens.svg\n    :target: https://pypi.python.org/pypi/cone.tokens\n    :alt: Number of PyPI downloads\n\n.. image:: https://github.com/conestack/cone.tokens/actions/workflows/python-package.yml/badge.svg\n    :target: https://github.com/conestack/cone.tokens/actions/workflows/python-package.yml\n    :alt: Package build\n\n.. image:: https://coveralls.io/repos/github/bluedynamics/cone.tokens/badge.svg?branch=master\n    :target: https://coveralls.io/github/bluedynamics/cone.tokens?branch=master\n\nThis package provides a unique token generator for ``cone.app``.\n\nFeatures:\n\n* QR Code generation\n* JSON API for token management\n\n\nApplication ini file configuration\n==================================\n\n- **cone.tokens.config_file**: Required. Path to tokens json config file.\n\n- **cone.tokens.settings_node_path**: Optional. Application node path to token settings node.\n\n- **cone.tokens.entryfactory**: Optional. Node class used as entry node factory.\n\n\nJSON API\n========\n\n``cone.tokens`` provides a JSON API for token management.\n\n\nquery_token\n-----------\n\nQuery token by value. It expects a ``GET`` request.\n\n**Schema**: URL/tokens/query_token\n\n**Params**\n\n- ``value``: A string containing the token value to look up.\n\n**Response**\n\n- ``success``: True or False.\n- ``token``: Token data or null if token not exists.\n- ``message``: On failure the error message is returned.\n\n\nadd_token\n---------\n\n``add_token`` is for generating a new token. It expects a ``POST`` request.\n\n**Schema**: URL/tokens/add_token\n\n**Params**\n\n- ``value``: A string containing the token value. If empty, the token uuid gets used as value.\n- ``valid_from``: A datetime in isoformat. If empty, token has no effective date.\n- ``valid_to``: A datetime in isoformat. If empty, token has no expiration date.\n- ``usage_count``: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times.\n- ``lock_time``: Time in seconds the token is locked after consumption as integer.\n\n**Response**\n\n- ``success``: True or False.\n- ``token_uid``: On success the token uid is returned.\n- ``message``: On failure the error message is returned.\n\n\nconsume_token\n-------------\n\n``consume_token`` is for consuming a token. It expects a ``GET`` request.\n\n**Schema**: URL/tokens/<UUID>/consume_token\n\n**Params**\n\n- No parametes expected.\n\n**Response**\n\n- ``success``: True or False.\n- ``consumed``: On success flag whether token consumption was valid.\n- ``message``: On failure the error message is returned.\n\n\nupdate_token\n------------\n\n``edit_token`` is for editing a token. It expects a ``POST`` request.\n\n**Schema**: URL/tokens/<UUID>/update_token\n\n**Params**\n\n- ``value``: A string containing the token value. If empty, the token uuid gets used as value. Unchanged if parameter is omitted.\n- ``valid_from``: A datetime in isoformat. If empty, token has no effective date. Unchanged if parameter is omitted.\n- ``valid_to``: A datetime in isoformat. If empty, token has no expiration date. Unchanged if parameter is omitted.\n- ``usage_count``: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times. Unchanged if parameter is omitted.\n- ``lock_time``: Time in seconds the token is locked after consumption as integer. Unchanged if parameter is omitted.\n\n**Response**\n\n- ``success``: True or False.\n- ``message``: On failure the error message is returned.\n\n\ndelete_token\n------------\n\n``delete_token`` is for deleting a token. It expects a ``POST`` request.\n\n**Schema**: URL/tokens/<UUID>/delete_token\n\n**Params**\n\n- No parametes expected.\n\n**Response**\n\n- ``success``: True or False.\n- ``message``: On failure the error message is returned.\n\n\nTODO\n====\n\n- Introduce ``consume`` permission for JSON API.\n\n\nContributors\n============\n\n- Robert Niederreiter\n- Torben Baumgartner\n- Lena Daxenbichler\n\n\nChanges\n=======\n\n0.4 (2024-02-12)\n----------------\n\n- Adopt Settings UI changes from ``cone.app``.\n  [rnix]\n\n\n0.3 (2023-09-28)\n----------------\n\n- Tokens can be bulk deleted.\n  [lenadax]\n\n- Tokens can be created from scanned value.\n  [rnix]\n\n\n0.2 (2023-09-27)\n----------------\n\n- Actually upload package to pypi.\n  [rnix]\n\n\n0.1 (2023-09-27)\n----------------\n\n- Initial work.\n  [rnix, toalba, lenadax]\n\n\nLicense\n=======\n\nMIT License\n\nCopyright (c) 2023-2024, Cone Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "cone token api",
    "version": "0.4",
    "project_urls": {
        "Homepage": "http://github.com/conestack/cone.tokens"
    },
    "split_keywords": [
        "node",
        "pyramid",
        "cone",
        "web"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c4a4b6c35900b34a6834d76c25849266cbf9af71edf1733c2c39db5ddbca959",
                "md5": "8b96881bbd7de1d0a91cf200b0184eb5",
                "sha256": "35f68fb2719175f13124a6cced99ce201dd80b77540d8d4fe91002bbbc34463f"
            },
            "downloads": -1,
            "filename": "cone.tokens-0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b96881bbd7de1d0a91cf200b0184eb5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 40606,
            "upload_time": "2024-02-12T10:17:32",
            "upload_time_iso_8601": "2024-02-12T10:17:32.114765Z",
            "url": "https://files.pythonhosted.org/packages/8c/4a/4b6c35900b34a6834d76c25849266cbf9af71edf1733c2c39db5ddbca959/cone.tokens-0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26756ae9331d298c33ec99fc1a4a95639133836a729d4df7a37f3a85bf0f9645",
                "md5": "6a8e1203d40a1826ee5e27f1fd1f29e1",
                "sha256": "8ef59689ee2aaac8fda7bd715870e96e72dc75cb9ba0158cf3c3cea3379692d1"
            },
            "downloads": -1,
            "filename": "cone.tokens-0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6a8e1203d40a1826ee5e27f1fd1f29e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30492,
            "upload_time": "2024-02-12T10:17:34",
            "upload_time_iso_8601": "2024-02-12T10:17:34.193624Z",
            "url": "https://files.pythonhosted.org/packages/26/75/6ae9331d298c33ec99fc1a4a95639133836a729d4df7a37f3a85bf0f9645/cone.tokens-0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-12 10:17:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "conestack",
    "github_project": "cone.tokens",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cone.tokens"
}
        
Elapsed time: 0.18124s