{"id":21030585,"url":"https://github.com/workfloworchestrator/oauth2-lib","last_synced_at":"2025-07-06T16:02:05.470Z","repository":{"id":37823548,"uuid":"302558752","full_name":"workfloworchestrator/oauth2-lib","owner":"workfloworchestrator","description":"Oauth2 library with an example implementation.","archived":false,"fork":false,"pushed_at":"2025-01-07T09:28:44.000Z","size":244,"stargazers_count":3,"open_issues_count":5,"forks_count":5,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-05-14T23:15:57.821Z","etag":null,"topics":["oauth2-lib"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workfloworchestrator.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":"2020-10-09T06:56:00.000Z","updated_at":"2025-04-30T02:40:01.000Z","dependencies_parsed_at":"2024-03-14T13:46:41.181Z","dependency_job_id":"41931f07-692a-4a53-95fc-710a39656fa6","html_url":"https://github.com/workfloworchestrator/oauth2-lib","commit_stats":{"total_commits":113,"total_committers":13,"mean_commits":8.692307692307692,"dds":0.504424778761062,"last_synced_commit":"d6682e1a11084a701eff9c40d3dc26c900e0c5d2"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workfloworchestrator%2Foauth2-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workfloworchestrator%2Foauth2-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workfloworchestrator%2Foauth2-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workfloworchestrator%2Foauth2-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workfloworchestrator","download_url":"https://codeload.github.com/workfloworchestrator/oauth2-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254330879,"owners_count":22053070,"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":["oauth2-lib"],"created_at":"2024-11-19T12:19:20.153Z","updated_at":"2025-07-06T16:02:05.464Z","avatar_url":"https://github.com/workfloworchestrator.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuth2-lib\n\n[![pypi_version](https://img.shields.io/pypi/v/oauth2-lib?color=%2334D058\u0026label=pypi%20package)](https://pypi.org/project/oauth2-lib)\n[![Supported python versions](https://img.shields.io/pypi/pyversions/oauth2-lib.svg?color=%2334D058)](https://pypi.org/project/oauth2-lib)\n[![codecov](https://codecov.io/gh/workfloworchestrator/oauth2-lib/graph/badge.svg?token=JDMMBBOVM4)](https://codecov.io/gh/workfloworchestrator/oauth2-lib)\n\nThis project contains a number of classes to perform authentication (AuthN) and authorization (AuthZ) in a FastAPI application.\n\nThey can be found in [oauth2_lib/fastapi.py](oauth2_lib/fastapi.py).\nMost notable are:\n- `OIDCAuth`: AuthN implementation that authenticates a user against a OIDC backend. You can subclass and implement `def userinfo()` as needed.\n  - To use a different AuthN method, subclass the `Authentication` base class.\n- `OIDCUserModel`: model of the data returned by `OIDCAuth`. You can subclass this to rename and/or add fields.\n- `OPAAuthorization`: AuthZ implementation that authorizes a user's HTTP request against an Open Policy Agent (OPA) instance.\n  - To use a different AuthZ method, subclass the `Authorization` base class.\n- `GraphQLOPAAuthorization`: AuthZ implementation that authorizes a user's GraphQL query against an Open Policy Agent (OPA) instance.\n  - To use a different AuthZ method, subclass the `GraphqlAuthorization` base class.\n- `OPAResult`: model of the data returned by `OPAAuthorization` and `GraphQLOPAAuthorization`.\n\nThe [orchestrator-core documentation](https://workfloworchestrator.org/orchestrator-core) has a section on Authentication and Authorization that describes how to use/override these classes.\n\n## Installation\n\nTo install the package from PyPI:\n\n```bash\npip install oauth2-lib\n```\n\n## Development\n\n### Virtual Environment\n\nSteps to setup a virtual environment.\n\n#### Step 1:\n\nCreate and activate a python3 virtualenv.\n\n#### Step 2:\n\nInstall flit to enable you to develop on this repository:\n\n```bash\npip install flit\n```\n\n#### Step 3:\n\nTo install all development dependencies:\n\n```bash\nflit install --deps develop\n```\n\nAll steps combined into 1 command:\n\n```bash\npython -m venv .venv \u0026\u0026 source .venv/bin/activate \u0026\u0026 pip install -U pip \u0026\u0026 pip install flit \u0026\u0026 flit install --deps develop\n```\n\n### Unit tests\n\nActivate the virtualenv and run the unit tests with:\n\n```bash\npytest\n```\n\n### Pre-commit\n\nThis project uses [pre-commit](https://pre-commit.com/) to automatically run a number of checks before making a git commit.\nThe same checks will be performed in the CI pipeline so this can save you some time.\n\nFirst ensure you have pre-commit installed.\nIt is recommended to install it outside the virtualenv.\nOn Linux and Mac, pre-commit is available in most package managers. Alternatively you can install it globally with [pipx](https://github.com/pypa/pipx).\n\nOnce pre-commit is installed, go into the project root and enable it:\n```bash\npre-commit install\n```\n\nThis should output `pre-commit installed at .git/hooks/pre-commit`. The next time you run `git commit` the pre-commit hooks will validate your changes.\n\n### Bump version\n\nDepending on the feature type, run bumpversion (patch|minor|major) to increment the version you are working on. For\nexample to update the increment the patch version use\n```bash\nbumpversion patch\n```\n\n## Supported Python versions\n\noauth2-lib must support the same python versions as [orchestrator-core](https://github.com/workfloworchestrator/orchestrator-core).\n\nExceptions to this rule are:\n* **A new python version is released:** oauth2-lib should support the new version before orchestrator-core does\n* **Support for an old python version is dropped:** oauth2-lib should drop the python version after orchestrator-core does\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkfloworchestrator%2Foauth2-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkfloworchestrator%2Foauth2-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkfloworchestrator%2Foauth2-lib/lists"}