Authentication & authorization helpers for eoAPI
Project description
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.
[!NOTE]
This package makes use of Github's automatically generated release notes. These can be later augmented if one sees fit.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eoapi_auth_utils-0.4.1.tar.gz.
File metadata
- Download URL: eoapi_auth_utils-0.4.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f3bf341268013340acf004b4a0b81e74b61b89e90cc9c12a9113446433b21d7
|
|
| MD5 |
3872db4e79beaa75585a8cefee9c0854
|
|
| BLAKE2b-256 |
a1f64650a5e59a305396ceb5e5aa176a19eee8687ee37efab276bf485c428873
|
Provenance
The following attestation bundles were made for eoapi_auth_utils-0.4.1.tar.gz:
Publisher:
publish.yaml on developmentseed/eoapi-auth-utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eoapi_auth_utils-0.4.1.tar.gz -
Subject digest:
7f3bf341268013340acf004b4a0b81e74b61b89e90cc9c12a9113446433b21d7 - Sigstore transparency entry: 152941177
- Sigstore integration time:
-
Permalink:
developmentseed/eoapi-auth-utils@aeb95fa18046bd7a88224038879b10389075abf1 -
Branch / Tag:
refs/tags/0.4.1 - Owner: https://github.com/developmentseed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@aeb95fa18046bd7a88224038879b10389075abf1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file eoapi_auth_utils-0.4.1-py3-none-any.whl.
File metadata
- Download URL: eoapi_auth_utils-0.4.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
137ec0d298e67eb82af0d5a1d8bdb125cd367e83c153cc76e0762c9c066b5309
|
|
| MD5 |
10a3b9e275ff4e488e7497fef1272888
|
|
| BLAKE2b-256 |
ca51187e684d6040df6ed3eb7785ce73efd7b7cc532d1fd179cf6b5c15c665c5
|
Provenance
The following attestation bundles were made for eoapi_auth_utils-0.4.1-py3-none-any.whl:
Publisher:
publish.yaml on developmentseed/eoapi-auth-utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eoapi_auth_utils-0.4.1-py3-none-any.whl -
Subject digest:
137ec0d298e67eb82af0d5a1d8bdb125cd367e83c153cc76e0762c9c066b5309 - Sigstore transparency entry: 152941178
- Sigstore integration time:
-
Permalink:
developmentseed/eoapi-auth-utils@aeb95fa18046bd7a88224038879b10389075abf1 -
Branch / Tag:
refs/tags/0.4.1 - Owner: https://github.com/developmentseed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@aeb95fa18046bd7a88224038879b10389075abf1 -
Trigger Event:
push
-
Statement type: