An Omnivector initiative
Armasec
Adding a security layer on top of your API can be difficult, especially when working with an OIDC platform. It's hard enough to get your OIDC provider configured correctly. Armasec aims to take the pain out of securing your APIs routes.
Armasec is an opinionated library that attempts to use the most obvious and commonly used workflows when working with OIDC and making configuration as simple as possible.
When using the Armasec helper class, you only need two configuration settings to get going:
- Domain: the domain of your OIDC provider
- Audience: An optional setting that restricts tokens to those intended for your API.
That's it! Once you have those settings dialed in, you can just worry about checking the permissions scopes of your endpoints
Documentation
Documentation is hosted hosted on github.io at
the Armasec homepage.
Quickstart
- Install
armasecanduvicorn:
pip install armasec uvicorn
- Save th Minimal Example (example.py) locally:
import os
from armasec import Armasec
from fastapi import FastAPI, Depends
app = FastAPI()
armasec = Armasec(
domain=os.environ.get("ARMASEC_DOMAIN"),
audience=os.environ.get("ARMASEC_AUDIENCE"),
)
@app.get("/stuff", dependencies=[Depends(armasec.lockdown("read:stuff"))])
async def check_access():
return dict(message="Successfully authenticated!")
- Set the Armasec environment variables:
- ARMASEC_DOMAIN
- ARMASEC_AUDIENCE
- Run the app
uvicorn --host 0.0.0.0 example:app
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for armasec 3.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| armasec-3.0.3.tar.gz | 3.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| armasec-3.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.0 MB
Release files / armasec-3.0.3.tar.gz
| Download URL | armasec-3.0.3.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8c0e5edc38a1581ed607494a17fb8bfb4573f716efe5b53a9546f9e61c037bd
|
|
BLAKE2b-256 checksum How to use checksums |
4179cdc45753b386878547872b8b787ded012fe5a701558294c5aa8d60bc27cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / armasec-3.0.3-py3-none-any.whl
| Download URL | armasec-3.0.3-py3-none-any.whl |
|---|---|
| Size | 35.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76f5e09e43b04b83cd4fcbcfaa9ca81427b25134101edc3dde07796f7d5d2627
|
|
BLAKE2b-256 checksum How to use checksums |
92506818db4ddb1e77164d0b696b6f24021e851fe9dea95e39564ce7b7202a85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|