eoAPI Auth Utils
Helpers for authentication & authorization patterns for eoAPI applications.
Usage
Installation
pip install eoapi.auth-utils
Integration
In your eoAPI application:
from eoapi.auth_utils import AuthSettings, OpenIdConnectAuth
from fastapi import FastAPI
from fastapi.routing import APIRoute
from stac_fastapi.api.app import StacApi
auth_settings = AuthSettings(_env_prefix="AUTH_")
api = StacApi(
app=FastAPI(
# ...
swagger_ui_init_oauth={
"clientId": auth_settings.client_id,
"usePkceWithAuthorizationCodeGrant": auth_settings.use_pkce,
},
),
# ...
)
if auth_settings.openid_configuration_url:
oidc_auth = OpenIdConnectAuth.from_settings(auth_settings)
# Implement your custom app-specific auth logic here...
restricted_routes = {
"/collections": ("POST", "stac:collection:create"),
"/collections/{collection_id}": ("PUT", "stac:collection:update"),
"/collections/{collection_id}": ("DELETE", "stac:collection:delete"),
"/collections/{collection_id}/items": ("POST", "stac:item:create"),
"/collections/{collection_id}/items/{item_id}": ("PUT", "stac:item:update"),
"/collections/{collection_id}/items/{item_id}": ("DELETE", "stac:item:delete"),
}
api_routes = {
route.path: route for route in api.app.routes if isinstance(route, APIRoute)
}
for endpoint, (method, scope) in restricted_routes.items():
route = api_routes.get(endpoint)
if route and method in route.methods:
oidc_auth.apply_auth_dependencies(route, required_token_scopes=[scope])
Development
Releases
Releases are managed via CICD workflow, as described in the Python Packaging User Guide. To create a new release:
- Update the version in
eoapi/auth_utils/__init__.pyfollowing appropriate Semantic Versioning convention. - Push a tagged commit to
main, with the tag matching the package's new version number.
Metadata
Release files for eoapi-auth-utils 0.4.1
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 |
|---|---|---|---|---|
| eoapi_auth_utils-0.4.1.tar.gz | 5.4 kB | With provenance | Details for eoapi_auth_utils-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eoapi_auth_utils-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for eoapi_auth_utils-0.4.1-py3-none-any.whl |
Total release size: 12.9 kB
Release files / eoapi_auth_utils-0.4.1.tar.gz
| Download URL | eoapi_auth_utils-0.4.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f3bf341268013340acf004b4a0b81e74b61b89e90cc9c12a9113446433b21d7
|
|
BLAKE2b-256 checksum How to use checksums |
a1f64650a5e59a305396ceb5e5aa176a19eee8687ee37efab276bf485c428873
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logRelease files / eoapi_auth_utils-0.4.1-py3-none-any.whl
| Download URL | eoapi_auth_utils-0.4.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
137ec0d298e67eb82af0d5a1d8bdb125cd367e83c153cc76e0762c9c066b5309
|
|
BLAKE2b-256 checksum How to use checksums |
ca51187e684d6040df6ed3eb7785ce73efd7b7cc532d1fd179cf6b5c15c665c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logSecurity for eoapi-auth-utils 0.4.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for eoapi_auth_utils-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logA 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.