multikeyjwt


Namemultikeyjwt JSON
Version 1.4.3 PyPI version JSON
download
home_pageNone
SummaryVerify JWTs with multiple public keys, FastAPI middleware for auth
upload_time2025-01-24 23:11:26
maintainerNone
docs_urlNone
authorEero af Heurlin
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===========
multikeyjwt
===========

Verify JWTs with multiple public keys, FastAPI middleware for auth

NOTE: Due to https://github.com/encode/starlette/discussions/2446 .env file is no longer
supported for configuration.

Creating signing keys
---------------------

.. code-block:: bash

    multikeyjwt genkey ./jwtsign.key

see --help for more info

Docker
------

For more controlled deployments and to get rid of "works on my computer" -syndrome, we always
make sure our software works under docker.

It's also a quick way to get started with a standard development environment.

SSH agent forwarding
^^^^^^^^^^^^^^^^^^^^

We need buildkit_::

    export DOCKER_BUILDKIT=1

.. _buildkit: https://docs.docker.com/develop/develop-images/build_enhancements/

And also the exact way for forwarding agent to running instance is different on OSX::

    export DOCKER_SSHAGENT="-v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock"

and Linux::

    export DOCKER_SSHAGENT="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"

Creating a development container
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Build image, create container and start it::

    docker build --ssh default --target devel_shell -t multikeyjwt:devel_shell .
    docker create --name multikeyjwt_devel -v `pwd`":/app" -it `echo $DOCKER_SSHAGENT` multikeyjwt:devel_shell
    docker start -i multikeyjwt_devel

pre-commit considerations
^^^^^^^^^^^^^^^^^^^^^^^^^

If working in Docker instead of native env you need to run the pre-commit checks in docker too::

    docker exec -i multikeyjwt_devel /bin/bash -c "pre-commit install"
    docker exec -i multikeyjwt_devel /bin/bash -c "pre-commit run --all-files"

You need to have the container running, see above. Or alternatively use the docker run syntax but using
the running container is faster::

    docker run --rm -it -v `pwd`":/app" multikeyjwt:devel_shell -c "pre-commit run --all-files"

Test suite
^^^^^^^^^^

You can use the devel shell to run py.test when doing development, for CI use
the "tox" target in the Dockerfile::

    docker build --ssh default --target tox -t multikeyjwt:tox .
    docker run --rm -it -v `pwd`":/app" `echo $DOCKER_SSHAGENT` multikeyjwt:tox

Production docker
^^^^^^^^^^^^^^^^^

There's a "production" target as well for running the application, remember to change that
architecture tag to arm64 if building on ARM::

    docker build --ssh default --target production -t multikeyjwt:latest .
    docker run -it --name multikeyjwt multikeyjwt:amd64-latest

Development
-----------

TLDR:

- Create and activate a Python 3.11 virtualenv (assuming virtualenvwrapper)::

    mkvirtualenv -p `which python3.11` my_virtualenv

- change to a branch::

    git checkout -b my_branch

- install Poetry: https://python-poetry.org/docs/#installation
- Install project deps and pre-commit hooks::

    poetry install
    pre-commit install
    pre-commit run --all-files

- Ready to go.

Remember to activate your virtualenv whenever working on the repo, this is needed
because pylint and mypy pre-commit hooks use the "system" python for now (because reasons).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "multikeyjwt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Eero af Heurlin",
    "author_email": "eero.afheurlin@iki.fi",
    "download_url": "https://files.pythonhosted.org/packages/32/00/aa19624c2b6e51712c1b223cb64820a422c2f2f8ca48bb035cd764562b8f/multikeyjwt-1.4.3.tar.gz",
    "platform": null,
    "description": "===========\nmultikeyjwt\n===========\n\nVerify JWTs with multiple public keys, FastAPI middleware for auth\n\nNOTE: Due to https://github.com/encode/starlette/discussions/2446 .env file is no longer\nsupported for configuration.\n\nCreating signing keys\n---------------------\n\n.. code-block:: bash\n\n    multikeyjwt genkey ./jwtsign.key\n\nsee --help for more info\n\nDocker\n------\n\nFor more controlled deployments and to get rid of \"works on my computer\" -syndrome, we always\nmake sure our software works under docker.\n\nIt's also a quick way to get started with a standard development environment.\n\nSSH agent forwarding\n^^^^^^^^^^^^^^^^^^^^\n\nWe need buildkit_::\n\n    export DOCKER_BUILDKIT=1\n\n.. _buildkit: https://docs.docker.com/develop/develop-images/build_enhancements/\n\nAnd also the exact way for forwarding agent to running instance is different on OSX::\n\n    export DOCKER_SSHAGENT=\"-v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock\"\n\nand Linux::\n\n    export DOCKER_SSHAGENT=\"-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK\"\n\nCreating a development container\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nBuild image, create container and start it::\n\n    docker build --ssh default --target devel_shell -t multikeyjwt:devel_shell .\n    docker create --name multikeyjwt_devel -v `pwd`\":/app\" -it `echo $DOCKER_SSHAGENT` multikeyjwt:devel_shell\n    docker start -i multikeyjwt_devel\n\npre-commit considerations\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf working in Docker instead of native env you need to run the pre-commit checks in docker too::\n\n    docker exec -i multikeyjwt_devel /bin/bash -c \"pre-commit install\"\n    docker exec -i multikeyjwt_devel /bin/bash -c \"pre-commit run --all-files\"\n\nYou need to have the container running, see above. Or alternatively use the docker run syntax but using\nthe running container is faster::\n\n    docker run --rm -it -v `pwd`\":/app\" multikeyjwt:devel_shell -c \"pre-commit run --all-files\"\n\nTest suite\n^^^^^^^^^^\n\nYou can use the devel shell to run py.test when doing development, for CI use\nthe \"tox\" target in the Dockerfile::\n\n    docker build --ssh default --target tox -t multikeyjwt:tox .\n    docker run --rm -it -v `pwd`\":/app\" `echo $DOCKER_SSHAGENT` multikeyjwt:tox\n\nProduction docker\n^^^^^^^^^^^^^^^^^\n\nThere's a \"production\" target as well for running the application, remember to change that\narchitecture tag to arm64 if building on ARM::\n\n    docker build --ssh default --target production -t multikeyjwt:latest .\n    docker run -it --name multikeyjwt multikeyjwt:amd64-latest\n\nDevelopment\n-----------\n\nTLDR:\n\n- Create and activate a Python 3.11 virtualenv (assuming virtualenvwrapper)::\n\n    mkvirtualenv -p `which python3.11` my_virtualenv\n\n- change to a branch::\n\n    git checkout -b my_branch\n\n- install Poetry: https://python-poetry.org/docs/#installation\n- Install project deps and pre-commit hooks::\n\n    poetry install\n    pre-commit install\n    pre-commit run --all-files\n\n- Ready to go.\n\nRemember to activate your virtualenv whenever working on the repo, this is needed\nbecause pylint and mypy pre-commit hooks use the \"system\" python for now (because reasons).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Verify JWTs with multiple public keys, FastAPI middleware for auth",
    "version": "1.4.3",
    "project_urls": {
        "Homepage": "https://github.com/pvarki/python-multikeyjwt/",
        "Repository": "https://github.com/pvarki/python-multikeyjwt/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a0bb185805e49c7f9e28dde6c64081ba6dd2145cb7b12c23660fba9d43099790",
                "md5": "bf9715eb5c36c2532becebbcc56f8b11",
                "sha256": "14bb69567ba77ac646eb434a482d4accc575c1be2652e4adb4802cb16cab59b4"
            },
            "downloads": -1,
            "filename": "multikeyjwt-1.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bf9715eb5c36c2532becebbcc56f8b11",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 12273,
            "upload_time": "2025-01-24T23:11:24",
            "upload_time_iso_8601": "2025-01-24T23:11:24.322619Z",
            "url": "https://files.pythonhosted.org/packages/a0/bb/185805e49c7f9e28dde6c64081ba6dd2145cb7b12c23660fba9d43099790/multikeyjwt-1.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3200aa19624c2b6e51712c1b223cb64820a422c2f2f8ca48bb035cd764562b8f",
                "md5": "2d794d3eac2471ff4288ba8b0e5aefdc",
                "sha256": "943d1b395001149af41f30efb71db44cf3cda8ea11160f7a757681faa8e5f38b"
            },
            "downloads": -1,
            "filename": "multikeyjwt-1.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2d794d3eac2471ff4288ba8b0e5aefdc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 9832,
            "upload_time": "2025-01-24T23:11:26",
            "upload_time_iso_8601": "2025-01-24T23:11:26.209324Z",
            "url": "https://files.pythonhosted.org/packages/32/00/aa19624c2b6e51712c1b223cb64820a422c2f2f8ca48bb035cd764562b8f/multikeyjwt-1.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-24 23:11:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pvarki",
    "github_project": "python-multikeyjwt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "multikeyjwt"
}
        
Elapsed time: 0.65045s