{"id":28956865,"url":"https://github.com/developmentseed/eoapi-auth-utils","last_synced_at":"2025-07-25T09:44:25.889Z","repository":{"id":254023516,"uuid":"845251432","full_name":"developmentseed/eoapi-auth-utils","owner":"developmentseed","description":"Helpers for applying authentication \u0026 authorization to eoAPI applications","archived":false,"fork":false,"pushed_at":"2024-12-02T20:39:24.000Z","size":25,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-02T21:30:06.374Z","etag":null,"topics":["eoapi","fastapi"],"latest_commit_sha":null,"homepage":"https://eoapi.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developmentseed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-20T22:18:35.000Z","updated_at":"2024-12-02T20:37:28.000Z","dependencies_parsed_at":"2024-08-26T20:26:19.384Z","dependency_job_id":null,"html_url":"https://github.com/developmentseed/eoapi-auth-utils","commit_stats":null,"previous_names":["developmentseed/eoapi-auth-utils"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/developmentseed/eoapi-auth-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Feoapi-auth-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Feoapi-auth-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Feoapi-auth-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Feoapi-auth-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developmentseed","download_url":"https://codeload.github.com/developmentseed/eoapi-auth-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Feoapi-auth-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261561190,"owners_count":23177545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eoapi","fastapi"],"created_at":"2025-06-23T21:41:04.431Z","updated_at":"2025-06-23T21:41:05.182Z","avatar_url":"https://github.com/developmentseed.png","language":"Python","readme":"# eoAPI Auth Utils\n\nHelpers for authentication \u0026 authorization patterns for [eoAPI applications](https://eoapi.dev).\n\n[![PyPI - Version](https://img.shields.io/pypi/v/eoapi.auth-utils)](https://pypi.org/project/eoapi.auth-utils/)\n\n## Usage\n\n### Installation\n\n```\npip install eoapi.auth-utils\n```\n\n### Integration\n\nIn your eoAPI application:\n\n```py\nfrom eoapi.auth_utils import AuthSettings, OpenIdConnectAuth\nfrom fastapi import FastAPI\nfrom fastapi.routing import APIRoute\nfrom stac_fastapi.api.app import StacApi\n\nauth_settings = AuthSettings(_env_prefix=\"AUTH_\")\n\napi = StacApi(\n    app=FastAPI(\n        # ...\n        swagger_ui_init_oauth={\n            \"clientId\": auth_settings.client_id,\n            \"usePkceWithAuthorizationCodeGrant\": auth_settings.use_pkce,\n        },\n    ),\n    # ...\n)\n\nif auth_settings.openid_configuration_url:\n    oidc_auth = OpenIdConnectAuth.from_settings(auth_settings)\n\n    # Implement your custom app-specific auth logic here...\n    restricted_routes = {\n        \"/collections\": (\"POST\", \"stac:collection:create\"),\n        \"/collections/{collection_id}\": (\"PUT\", \"stac:collection:update\"),\n        \"/collections/{collection_id}\": (\"DELETE\", \"stac:collection:delete\"),\n        \"/collections/{collection_id}/items\": (\"POST\", \"stac:item:create\"),\n        \"/collections/{collection_id}/items/{item_id}\": (\"PUT\", \"stac:item:update\"),\n        \"/collections/{collection_id}/items/{item_id}\": (\"DELETE\", \"stac:item:delete\"),\n    }\n    api_routes = {\n        route.path: route for route in api.app.routes if isinstance(route, APIRoute)\n    }\n    for endpoint, (method, scope) in restricted_routes.items():\n        route = api_routes.get(endpoint)\n        if route and method in route.methods:\n            oidc_auth.apply_auth_dependencies(route, required_token_scopes=[scope])\n```\n\n\n## Development\n\n### Releases\n\nReleases are managed via CICD workflow, as described in the [Python Packaging User Guide](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/). To create a new release:\n\n1. Update the version in `eoapi/auth_utils/__init__.py` following appropriate [Semantic Versioning convention](https://semver.org/).\n1. Push a tagged commit to `main`, with the tag matching the package's new version number.\n\n\u003e [!NOTE]  \n\u003e This package makes use of Github's [automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes). These can be later augmented if one sees fit.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Feoapi-auth-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentseed%2Feoapi-auth-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Feoapi-auth-utils/lists"}