{"id":19240328,"url":"https://github.com/python-gino/authlib-gino","last_synced_at":"2025-02-23T14:25:33.037Z","repository":{"id":51352341,"uuid":"269523103","full_name":"python-gino/authlib-gino","owner":"python-gino","description":"OpenID Connect provider implemented with Authlib and GINO.","archived":false,"fork":false,"pushed_at":"2021-05-13T20:47:57.000Z","size":148,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T02:42:53.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-gino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-05T03:35:09.000Z","updated_at":"2020-09-07T21:39:49.000Z","dependencies_parsed_at":"2022-09-24T19:51:48.832Z","dependency_job_id":null,"html_url":"https://github.com/python-gino/authlib-gino","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-gino%2Fauthlib-gino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-gino%2Fauthlib-gino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-gino%2Fauthlib-gino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-gino%2Fauthlib-gino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-gino","download_url":"https://codeload.github.com/python-gino/authlib-gino/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240326279,"owners_count":19783816,"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":[],"created_at":"2024-11-09T17:07:00.204Z","updated_at":"2025-02-23T14:25:33.007Z","avatar_url":"https://github.com/python-gino.png","language":"Python","readme":"# Authlib-GINO\n\nThis experimental and transitional library provides:\n\n* `starlette_oauth2` - OAuth2 Provider using Starlette\n* `gino_oauth2` - OAuth2 model mixins using GINO\n* `async_grants` - Asynchronous Authlib grants for OAuth2 and OpenID Connect\n* `fastapi_session` - A GINO App extension for session management using\n  OpenID Connect / public client / PKCE\n\n**CAUTION**: Code is copy'n'pasted from Authlib and modified for async.\n**CAUTION**: `fastapi_session` contains lots of assumptions.\n\n## Async OAuth2 Provider\n\nREADME TBD\n\n\n## GINO App\n\nGINO App is a loosely-defined FastAPI application that can be built with extensions from\nmultiple repositories. A GINO App should provide these entry points under `gino.app`\nsection:\n\n* `db` - a global `gino.Gino` instance\n* `config` - a global `starlette.config.Config` instance\n\nThey will be used in extensions to add more config, define additional models and run\nqueries. An example GINO App looks like this `example/app.py`:\n\n```python\nfrom gino.ext.starlette import Gino\nfrom starlette.config import Config\n\ndb = Gino(...)\nconfig = Config(...)\n```\n\nThen define the entry points in `pyprorject.toml` if Poetry is used:\n\n```toml\n[tool.poetry.plugins.\"gino.app\"]\n\"db\" = \"example.app:db\"\n\"config\" = \"example.app:config\"\n```\n\n## FastAPI Session\n\n```bash\n$ poetry add authlib-gino -E app\n```\n\nFastAPI Session module provides these GINO App extensions as entry points under\n`gino.app.extensions` section:\n\n* `session.oidc` - Includes OpenID Connect endpoints, model implementation and migration\n* `session.admin` - Includes session management endpoints\n* `session.demo` - A demo login endpoint\n\nIn order to utilize these extensions, create a FastAPI application and feed it to:\n\n```python\nfrom importlib.metadata import entry_points\nfrom fastapi import FastAPI\n\nENABLED_EXTENSIONS = {\"session.oidc\", \"session.admin\"}\n\napp = FastAPI(...)\nfor ep in entry_points()[\"gino.app.extensions\"]:\n    if ep.name in ENABLED_EXTENSIONS:\n        ep.load()(app)\n```\n\nExtension defines database schema migrations with entry points of the same name under\n`gino.app.migrations` section. To include them in your project, initialize an Alembic\nenvironment and add this to `env.py`:\n\n```python\nfrom importlib.metadata import entry_points\nfrom importlib.resources import path\nfrom example.app import ENABLED_EXTENSIONS\n\nfor ep in entry_points()[\"gino.app.migrations\"]:\n    if ep.name in ENABLED_EXTENSIONS:\n        with path(*ep.value.split(\":\", maxsplit=1)) as loc:\n            context.script.version_locations.append(str(loc / \"versions\"))\n```\n\nAs we are appending to `version_locations`, `alembic.ini` also needs the initial local\nlocation (change example below to match your layout):\n\n```ini\n[alembic]\nversion_locations = migrations/versions\n```\n\nThen run `alembic upgrade heads` (not `head`) to apply the migrations. Read more about\n[working with multiple bases in Alembic](\nhttps://alembic.sqlalchemy.org/en/latest/branches.html#working-with-multiple-bases).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-gino%2Fauthlib-gino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-gino%2Fauthlib-gino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-gino%2Fauthlib-gino/lists"}