Python utility package for verifying & decoding OKTA tokens
Reason this release was yanked:
still in testing
Project description
oktagon-python
This python package is a tiny utility for verifying & decoding OKTA tokens in python backend services.
Installation
pip install oktagon-python
Getting Started
Let's say you have /consignments REST API endpoint which you'd like to make accessible only by logistics OKTA group. Then you would write something like this:
import os
from oktagon_python.authorisation import AuthorisationManager
from starlette.requests import Request
auth_manager = AuthorisationManager(
service_name="your_service_name",
okta_issuer=os.environ.get("OKTAGON_OKTA_ISSUER"),
okta_audience=os.environ.get("OKTAGON_OKTA_AUDIENCE"),
)
async def is_authorised(request: Request):
return await auth_manager.is_user_authorised(
allowed_groups=["logistics"],
resource_name="consignments",
cookies=request.cookies
)
This will create an AuthorisationManager
instance that will check user's
authorisation.
Contributing
git clone https://github.com/madedotcom/oktagon-python.git
cd oktagon-python
make install
make tests
This will install all the dependencies (including dev ones) and run the tests.
Run the formatters/linters
make pretty
Will run all the formatters and linters (black
, isort
and pylint
) in write mode.
make pretty-check
Will run the formatters and linters in check mode.
You can also run them separtly with make black
, make isort
, make pylint
.
Realeses
Merging a PR into the main
branch will trigger the GitHub release
workflow.
The following GitHub actions will be triggered:
- github-tag-action will bump a new
tag with
patch
version by default. Add#major
or#minor
to the merge commit message to bump a different tag; - gh-action-pypi-publish will push the newly built package on PyPI;
- action-automatic-releases
will create the GitHub release and tag it with
latest
as well.
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
File details
Details for the file oktagon-python-0.0.15.tar.gz
.
File metadata
- Download URL: oktagon-python-0.0.15.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db823603943ef48c0943efb13b0cad6e3707125aa529b72218fdff1becb45072 |
|
MD5 | 9016b4558f19503555fa10b18aa06544 |
|
BLAKE2b-256 | 0286f64b40a49cf684770fc57e05cced8894ff43276da5e89e23af4a337e41c6 |
File details
Details for the file oktagon_python-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: oktagon_python-0.0.15-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b9e854f11fdde0ec4141ec6eaba43171b20268f18269c320442fe8064512f6 |
|
MD5 | 392bde87458577a7401b0eda64a86ce0 |
|
BLAKE2b-256 | 93fbe4a26ed489d14c5d35e644103e6827cce8cb011221ef8ac638adab7ce1b6 |