This release is a pre-release and may not be stable for production use.
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
patchversion by default. Add#majoror#minorto 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
latestas well.
Metadata
Release files for oktagon-python 0.0.16.dev1652457499
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oktagon-python-0.0.16.dev1652457499.tar.gz | 3.6 kB | Without provenance | Details for oktagon-python-0.0.16.dev1652457499.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oktagon_python-0.0.16.dev1652457499-py3-none-any.whl | Python 3 | none | any | Details for oktagon_python-0.0.16.dev1652457499-py3-none-any.whl |
Total release size: 6.9 kB
Release files / oktagon-python-0.0.16.dev1652457499.tar.gz
| Download URL | oktagon-python-0.0.16.dev1652457499.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b8bedfd67fe3c854fa84ed0e21a38f0f388e7713b166274642949c923e43a79
|
|
BLAKE2b-256 checksum How to use checksums |
2cf9c39b65035f27bb0e5e354e9d459ccab28f43c7a9288941a36ee95d55e1f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1022-azure
|
Release files / oktagon_python-0.0.16.dev1652457499-py3-none-any.whl
| Download URL | oktagon_python-0.0.16.dev1652457499-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef0e9a09b577c3e48d484db804212e485ba0255eecfa3d53f3ce31457bfc95d3
|
|
BLAKE2b-256 checksum How to use checksums |
d99da9ecc0b809ba402ff01ac021ac559f90d0941991c6e9f301e56c30c83f71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1022-azure
|
Security for oktagon-python 0.0.16.dev1652457499
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.