├── .editorconfig ├── .flake8 ├── .github ├── actions │ └── setup-python-env │ │ └── action.yml ├── dependabot.yml └── workflows │ └── main.yml ├── .gitignore ├── .gitlint ├── .isort.cfg ├── .pre-commit-config.yaml ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── pyproject.toml ├── readme.md ├── src └── fastapi_key_auth │ ├── __init__.py │ ├── dependency │ ├── __init__.py │ └── authorizer.py │ ├── middleware │ ├── __init__.py │ └── authorizer.py │ └── utils.py ├── tests ├── __init__.py ├── conftest.py ├── test_dependency_authorizer.py ├── test_dependency_custom_pattern.py ├── test_middleware_authorizer.py └── test_middleware_custom_pattern.py └── uv.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | charset = utf-8 9 | end_of_line = lf 10 | 11 | [LICENSE] 12 | insert_final_newline = false 13 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 100 3 | ignore = E501, E203, W503 4 | per-file-ignores = 5 | __init__.py:F401 6 | exclude = 7 | .git 8 | __pycache__ 9 | .mypy_cache 10 | .pytest_cache 11 | .vscode 12 | .github 13 | tests/ 14 | tmp/ 15 | .venv/ 16 | -------------------------------------------------------------------------------- /.github/actions/setup-python-env/action.yml: -------------------------------------------------------------------------------- 1 | name: "setup python environment" 2 | description: "setup python environment" 3 | 4 | inputs: 5 | python-version: 6 | description: "Python version to use" 7 | required: true 8 | default: "3.12" 9 | uv-version: 10 | description: "uv version to use" 11 | required: true 12 | default: "0.6.2" 13 | 14 | runs: 15 | using: "composite" 16 | steps: 17 | - uses: actions/setup-python@v5 18 | with: 19 | python-version: ${{ inputs.python-version }} 20 | 21 | - name: Install uv 22 | uses: astral-sh/setup-uv@v6 23 | with: 24 | version: ${{ inputs.uv-version }} 25 | enable-cache: 'true' 26 | cache-suffix: ${{ matrix.python-version }} 27 | 28 | - name: Install Python dependencies 29 | run: uv sync --frozen 30 | shell: bash 31 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: uv 5 | directory: / 6 | schedule: 7 | interval: weekly 8 | 9 | - package-ecosystem: github-actions 10 | directory: / 11 | schedule: 12 | interval: weekly 13 | 14 | - package-ecosystem: docker 15 | directory: / 16 | schedule: 17 | interval: weekly 18 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Main 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | types: [opened, synchronize, reopened, ready_for_review] 9 | 10 | jobs: 11 | quality: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out 15 | uses: actions/checkout@v4 16 | 17 | - uses: actions/cache@v4 18 | with: 19 | path: ~/.cache/pre-commit 20 | key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} 21 | 22 | - name: Set up the environment 23 | uses: ./.github/actions/setup-python-env 24 | 25 | - name: Run checks 26 | run: make check 27 | 28 | tests-and-type-check: 29 | runs-on: ubuntu-latest 30 | strategy: 31 | matrix: 32 | python-version: ["3.10", "3.11", "3.12", "3.13"] 33 | fail-fast: false 34 | defaults: 35 | run: 36 | shell: bash 37 | steps: 38 | - name: Check out 39 | uses: actions/checkout@v4 40 | 41 | - name: Set up the environment 42 | uses: ./.github/actions/setup-python-env 43 | with: 44 | python-version: ${{ matrix.python-version }} 45 | 46 | - name: Run tests 47 | run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml 48 | 49 | - name: Check typing 50 | run: uv run mypy 51 | 52 | release: 53 | if: github.event_name == 'push' 54 | runs-on: ubuntu-latest 55 | environment: 56 | name: pypi 57 | url: https://pypi.org/p/fastapi-key-auth 58 | permissions: 59 | id-token: write 60 | contents: write 61 | needs: [quality, tests-and-type-check] 62 | steps: 63 | - uses: actions/checkout@v4 64 | with: 65 | fetch-depth: 0 66 | 67 | - uses: actions/cache@v4 68 | with: 69 | path: ~/.cache/pre-commit 70 | key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} 71 | 72 | - name: Set up the environment 73 | uses: ./.github/actions/setup-python-env 74 | 75 | - name: Python Semantic Release 76 | id: release 77 | uses: python-semantic-release/python-semantic-release@v9.21.1 78 | with: 79 | github_token: ${{ secrets.GITHUB_TOKEN }} 80 | 81 | - name: Publish package distributions to PyPI 82 | uses: pypa/gh-action-pypi-publish@release/v1 83 | # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. 84 | # See https://github.com/actions/runner/issues/1173 85 | if: steps.release.outputs.released == 'true' 86 | 87 | - name: Publish package distributions to GitHub Releases 88 | uses: python-semantic-release/upload-to-gh-release@main 89 | if: steps.release.outputs.released == 'true' 90 | with: 91 | github_token: ${{ secrets.GITHUB_TOKEN }} 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vim 2 | .vscode 3 | .DS_Store 4 | tmp/ 5 | .python-version 6 | 7 | # Byte-compiled / optimized / DLL files 8 | __pycache__/ 9 | *.py[cod] 10 | *$py.class 11 | 12 | # C extensions 13 | *.so 14 | 15 | # Distribution / packaging 16 | .Python 17 | build/ 18 | develop-eggs/ 19 | dist/ 20 | downloads/ 21 | eggs/ 22 | .eggs/ 23 | lib/ 24 | lib64/ 25 | parts/ 26 | sdist/ 27 | var/ 28 | wheels/ 29 | share/python-wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .nox/ 49 | .coverage 50 | .coverage.* 51 | .cache 52 | nosetests.xml 53 | coverage.xml 54 | *.cover 55 | *.py,cover 56 | .hypothesis/ 57 | .pytest_cache/ 58 | cover/ 59 | 60 | # Sphinx documentation 61 | docs/_build/ 62 | 63 | # PyBuilder 64 | .pybuilder/ 65 | target/ 66 | 67 | # Jupyter Notebook 68 | .ipynb_checkpoints 69 | 70 | # IPython 71 | profile_default/ 72 | ipython_config.py 73 | 74 | # pyenv 75 | # For a library or package, you might want to ignore these files since the code is 76 | # intended to run in multiple environments; otherwise, check them in: 77 | # .python-version 78 | 79 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 80 | __pypackages__/ 81 | 82 | # Environments 83 | .env 84 | 85 | # mkdocs documentation 86 | /site 87 | 88 | # mypy 89 | .mypy_cache/ 90 | .dmypy.json 91 | dmypy.json 92 | 93 | # pytype static type analyzer 94 | .pytype/ 95 | 96 | # Cython debug symbols 97 | cython_debug/ 98 | s 99 | -------------------------------------------------------------------------------- /.gitlint: -------------------------------------------------------------------------------- 1 | # Edit this file as you like. 2 | # 3 | # All these sections are optional. Each section with the exception of [general] represents 4 | # one rule and each key in it is an option for that specific rule. 5 | # 6 | # Rules and sections can be referenced by their full name or by id. For example 7 | # section "[body-max-line-length]" could also be written as "[B1]". Full section names are 8 | # used in here for clarity. 9 | # 10 | [general] 11 | # Ignore certain rules, this example uses both full name and id 12 | # ignore=title-trailing-punctuation, T3 13 | 14 | # verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this 15 | # verbosity = 2 16 | 17 | # By default gitlint will ignore merge, revert, fixup and squash commits. 18 | # ignore-merge-commits=true 19 | # ignore-revert-commits=true 20 | # ignore-fixup-commits=true 21 | # ignore-squash-commits=true 22 | 23 | # Ignore any data send to gitlint via stdin 24 | # ignore-stdin=true 25 | 26 | # Fetch additional meta-data from the local repository when manually passing a 27 | # commit message to gitlint via stdin or --commit-msg. Disabled by default. 28 | # staged=true 29 | 30 | # Enable debug mode (prints more output). Disabled by default. 31 | # debug=true 32 | 33 | # Enable community contributed rules 34 | # See http://jorisroovers.github.io/gitlint/contrib_rules for details 35 | contrib=contrib-title-conventional-commits 36 | 37 | # Set the extra-path where gitlint will search for user defined rules 38 | # See http://jorisroovers.github.io/gitlint/user_defined_rules for details 39 | # extra-path=examples/ 40 | 41 | # This is an example of how to configure the "title-max-length" rule and 42 | # set the line-length it enforces to 80 43 | # [title-max-length] 44 | # line-length=50 45 | 46 | # Conversely, you can also enforce minimal length of a title with the 47 | # "title-min-length" rule: 48 | # [title-min-length] 49 | # min-length=5 50 | 51 | # [title-must-not-contain-word] 52 | # Comma-separated list of words that should not occur in the title. Matching is case 53 | # insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING" 54 | # will not cause a violation, but "WIP: my title" will. 55 | # words=wip 56 | 57 | # [title-match-regex] 58 | # python-style regex that the commit-msg title must match 59 | # Note that the regex can contradict with other rules if not used correctly 60 | # (e.g. title-must-not-contain-word). 61 | # regex=^US[0-9]* 62 | 63 | # [body-max-line-length] 64 | # line-length=72 65 | 66 | # [body-min-length] 67 | # min-length=5 68 | 69 | #[body-is-missing] 70 | # Whether to ignore this rule on merge commits (which typically only have a title) 71 | # default = True 72 | #ignore-merge-commits=false 73 | 74 | # [body-changed-file-mention] 75 | # List of files that need to be explicitly mentioned in the body when they are changed 76 | # This is useful for when developers often erroneously edit certain files or git submodules. 77 | # By specifying this rule, developers can only change the file when they explicitly reference 78 | # it in the commit message. 79 | # files=gitlint/rules.py,README.md 80 | 81 | # [body-match-regex] 82 | # python-style regex that the commit-msg body must match. 83 | # E.g. body must end in My-Commit-Tag: foo 84 | # regex=My-Commit-Tag: foo$ 85 | 86 | # [author-valid-email] 87 | # python-style regex that the commit author email address must match. 88 | # For example, use the following regex if you only want to allow email addresses from foo.com 89 | # regex=[^@]+@foo.com 90 | 91 | # [ignore-by-title] 92 | # Ignore certain rules for commits of which the title matches a regex 93 | # E.g. Match commit titles that start with "Release" 94 | # regex=^Release(.*) 95 | 96 | # Ignore certain rules, you can reference them by their id or by their full name 97 | # Use 'all' to ignore all rules 98 | ignore=B6,CC1 99 | 100 | # [ignore-by-body] 101 | # Ignore certain rules for commits of which the body has a line that matches a regex 102 | # E.g. Match bodies that have a line that that contain "release" 103 | # regex=(.*)release(.*) 104 | # 105 | # Ignore certain rules, you can reference them by their id or by their full name 106 | # Use 'all' to ignore all rules 107 | # ignore=T1,body-min-length 108 | 109 | # [ignore-body-lines] 110 | # Ignore certain lines in a commit body that match a regex. 111 | # E.g. Ignore all lines that start with 'Co-Authored-By' 112 | # regex=^Co-Authored-By 113 | 114 | # This is a contrib rule - a community contributed rule. These are disabled by default. 115 | # You need to explicitly enable them one-by-one by adding them to the "contrib" option 116 | # under [general] section above. 117 | # [contrib-title-conventional-commits] 118 | # Specify allowed commit types. For details see: https://www.conventionalcommits.org/ 119 | #types = feat,fix,refactor,docs,ci,chore 120 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | line_length = 88 3 | multi_line_output = 3 4 | include_trailing_comma = True 5 | known_third_party = aioredis,pydantic,pytest 6 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v5.0.0 4 | hooks: 5 | - id: end-of-file-fixer 6 | - id: trailing-whitespace 7 | args: ["--markdown-linebreak-ext=md"] 8 | - id: check-ast 9 | - repo: https://github.com/jorisroovers/gitlint 10 | rev: v0.19.1 # Fill in a tag / sha here 11 | hooks: 12 | - id: gitlint 13 | - repo: https://github.com/pre-commit/pre-commit-hooks 14 | rev: "v5.0.0" 15 | hooks: 16 | - id: check-case-conflict 17 | - id: check-merge-conflict 18 | - id: check-yaml 19 | - repo: https://github.com/pre-commit/mirrors-mypy 20 | rev: v1.15.0 21 | hooks: 22 | - id: mypy 23 | args: [--ignore-missing-imports] 24 | additional_dependencies: [types-redis] 25 | - repo: https://github.com/astral-sh/ruff-pre-commit 26 | rev: "v0.11.10" 27 | hooks: 28 | - id: ruff 29 | args: [--exit-non-zero-on-fix] 30 | - id: ruff-format 31 | - repo: https://github.com/astral-sh/uv-pre-commit 32 | rev: 0.7.5 33 | hooks: 34 | - id: uv-lock 35 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | 4 | ## v0.15.5 (2025-05-17) 5 | 6 | ### Build System 7 | 8 | - Fix version path 9 | ([`7624c8f`](https://github.com/iwpnd/fastapi-key-auth/commit/7624c8f4535b7680c8fc3aa02b44873cff92d261)) 10 | 11 | - Update actions 12 | ([`a8528fb`](https://github.com/iwpnd/fastapi-key-auth/commit/a8528fbff3dbeeda57c4351a7bfa1efe84b5c512)) 13 | 14 | - Uv 15 | ([`e0f0819`](https://github.com/iwpnd/fastapi-key-auth/commit/e0f0819ad5b25a48e53378f27d8e467fd20629b5)) 16 | 17 | ### Chores 18 | 19 | - Linter 20 | ([`732cae1`](https://github.com/iwpnd/fastapi-key-auth/commit/732cae186230d8b496ea137576aace7ea46ca974)) 21 | 22 | - Pre-commit autoupdate 23 | ([`a93b17c`](https://github.com/iwpnd/fastapi-key-auth/commit/a93b17ca6d1489c6f18d32d06a4e8b4da120f197)) 24 | 25 | - **deps**: Bump actions/cache from 4.1.2 to 4.2.2 26 | ([`1ca3f0b`](https://github.com/iwpnd/fastapi-key-auth/commit/1ca3f0bebe987128e3f27c19a178328de674be84)) 27 | 28 | Bumps [actions/cache](https://github.com/actions/cache) from 4.1.2 to 4.2.2. - [Release 29 | notes](https://github.com/actions/cache/releases) - 30 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 31 | [Commits](https://github.com/actions/cache/compare/v4.1.2...v4.2.2) 32 | 33 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 34 | 35 | update-type: version-update:semver-minor ... 36 | 37 | Signed-off-by: dependabot[bot] 38 | 39 | - **deps**: Bump fastapi 40 | ([`5ac9ec8`](https://github.com/iwpnd/fastapi-key-auth/commit/5ac9ec819ea19810944c8f6f88d41d6358878822)) 41 | 42 | - **deps**: Bump fastapi from 0.115.3 to 0.115.5 43 | ([`9962f16`](https://github.com/iwpnd/fastapi-key-auth/commit/9962f163c6a340429d0015932dda863ab48056c2)) 44 | 45 | Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.115.3 to 0.115.5. - [Release 46 | notes](https://github.com/fastapi/fastapi/releases) - 47 | [Commits](https://github.com/fastapi/fastapi/compare/0.115.3...0.115.5) 48 | 49 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 50 | 51 | update-type: version-update:semver-patch ... 52 | 53 | Signed-off-by: dependabot[bot] 54 | 55 | - **deps**: Bump python-semantic-release/python-semantic-release 56 | ([`f81a441`](https://github.com/iwpnd/fastapi-key-auth/commit/f81a44168452ce31a97b09a37bf525233c966f0f)) 57 | 58 | Bumps 59 | [python-semantic-release/python-semantic-release](https://github.com/python-semantic-release/python-semantic-release) 60 | from 9.16.1 to 9.21.0. - [Release 61 | notes](https://github.com/python-semantic-release/python-semantic-release/releases) - 62 | [Changelog](https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.rst) 63 | - 64 | [Commits](https://github.com/python-semantic-release/python-semantic-release/compare/v9.16.1...v9.21.0) 65 | 66 | --- updated-dependencies: - dependency-name: python-semantic-release/python-semantic-release 67 | dependency-type: direct:production 68 | 69 | update-type: version-update:semver-minor ... 70 | 71 | Signed-off-by: dependabot[bot] 72 | 73 | - **deps**: Bump python-semantic-release/python-semantic-release 74 | ([`83e3fcd`](https://github.com/iwpnd/fastapi-key-auth/commit/83e3fcd051c544154149e97d119184ed5662caf1)) 75 | 76 | Bumps 77 | [python-semantic-release/python-semantic-release](https://github.com/python-semantic-release/python-semantic-release) 78 | from 9.8.6 to 9.8.7. - [Release 79 | notes](https://github.com/python-semantic-release/python-semantic-release/releases) - 80 | [Changelog](https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.md) 81 | - 82 | [Commits](https://github.com/python-semantic-release/python-semantic-release/compare/v9.8.6...v9.8.7) 83 | 84 | --- updated-dependencies: - dependency-name: python-semantic-release/python-semantic-release 85 | dependency-type: direct:production 86 | 87 | update-type: version-update:semver-patch ... 88 | 89 | Signed-off-by: dependabot[bot] 90 | 91 | - **deps**: Bump starlette from 0.41.3 to 0.46.0 92 | ([`f62db4c`](https://github.com/iwpnd/fastapi-key-auth/commit/f62db4c4ad8a4f8e335864cc33216c16f68e0e68)) 93 | 94 | Bumps [starlette](https://github.com/encode/starlette) from 0.41.3 to 0.46.0. - [Release 95 | notes](https://github.com/encode/starlette/releases) - 96 | [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md) - 97 | [Commits](https://github.com/encode/starlette/compare/0.41.3...0.46.0) 98 | 99 | --- updated-dependencies: - dependency-name: starlette dependency-type: direct:production 100 | 101 | update-type: version-update:semver-minor ... 102 | 103 | Signed-off-by: dependabot[bot] 104 | 105 | ### Documentation 106 | 107 | - Update readme 108 | ([`870d2af`](https://github.com/iwpnd/fastapi-key-auth/commit/870d2af2bd1bf66d45a7d741f53522278469fa86)) 109 | 110 | 111 | ## v0.15.4 (2024-08-15) 112 | 113 | ### Chores 114 | 115 | - Bump fastapi 116 | ([`25f7b07`](https://github.com/iwpnd/fastapi-key-auth/commit/25f7b07ca0a6055847b1df639c3123c4e1ccb50b)) 117 | 118 | - Fix ruff lint command 119 | ([`daa0ef5`](https://github.com/iwpnd/fastapi-key-auth/commit/daa0ef53b162656c9ecb9ab9aa434ee98526be8a)) 120 | 121 | - Precommit autoupdate 122 | ([`fbc0578`](https://github.com/iwpnd/fastapi-key-auth/commit/fbc0578525b60a72716f92b277c9ed14fdd3ccc6)) 123 | 124 | - **deps**: Bump python-semantic-release/python-semantic-release 125 | ([`fff8014`](https://github.com/iwpnd/fastapi-key-auth/commit/fff8014df635fa02a1ef5be3c523ad3e9fef7254)) 126 | 127 | Bumps 128 | [python-semantic-release/python-semantic-release](https://github.com/python-semantic-release/python-semantic-release) 129 | from 9.8.0 to 9.8.3. - [Release 130 | notes](https://github.com/python-semantic-release/python-semantic-release/releases) - 131 | [Changelog](https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.md) 132 | - 133 | [Commits](https://github.com/python-semantic-release/python-semantic-release/compare/v9.8.0...v9.8.3) 134 | 135 | --- updated-dependencies: - dependency-name: python-semantic-release/python-semantic-release 136 | dependency-type: direct:production 137 | 138 | update-type: version-update:semver-patch ... 139 | 140 | Signed-off-by: dependabot[bot] 141 | 142 | - **deps**: Bump python-semantic-release/python-semantic-release 143 | ([`2c58f13`](https://github.com/iwpnd/fastapi-key-auth/commit/2c58f132106dea668034e623209818152cb7677b)) 144 | 145 | Bumps 146 | [python-semantic-release/python-semantic-release](https://github.com/python-semantic-release/python-semantic-release) 147 | from 9.6.0 to 9.8.0. - [Release 148 | notes](https://github.com/python-semantic-release/python-semantic-release/releases) - 149 | [Changelog](https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.md) 150 | - 151 | [Commits](https://github.com/python-semantic-release/python-semantic-release/compare/v9.6.0...v9.8.0) 152 | 153 | --- updated-dependencies: - dependency-name: python-semantic-release/python-semantic-release 154 | dependency-type: direct:production 155 | 156 | update-type: version-update:semver-minor ... 157 | 158 | Signed-off-by: dependabot[bot] 159 | 160 | ### Performance Improvements 161 | 162 | - Bump pydantic 163 | ([`bbbbad6`](https://github.com/iwpnd/fastapi-key-auth/commit/bbbbad6e5987463a4712c972f63152bb6b84ad6c)) 164 | 165 | 166 | ## v0.15.3 (2024-05-05) 167 | 168 | ### Chores 169 | 170 | - Allow chore(deps) tag to publish patch 171 | ([`d21ff4a`](https://github.com/iwpnd/fastapi-key-auth/commit/d21ff4a4690cd9e1dab4f6fd835134ec3ee42348)) 172 | 173 | - Allow chore-deps tag to publish patch 174 | ([`183518b`](https://github.com/iwpnd/fastapi-key-auth/commit/183518b034fa7da9ee84c7efb4f368971a121516)) 175 | 176 | - Exclude_commit_patterns for changelog [skip ci] 177 | ([`602daab`](https://github.com/iwpnd/fastapi-key-auth/commit/602daabfeac9ab23717665321b958ae0ec7e4783)) 178 | 179 | - Remove pydantic oops 180 | ([`3ea6d80`](https://github.com/iwpnd/fastapi-key-auth/commit/3ea6d8043d72e4244ae466ff903fdc841d22e501)) 181 | 182 | - Remove redundant deps 183 | ([`26a7dd8`](https://github.com/iwpnd/fastapi-key-auth/commit/26a7dd8e60e4359b3005678dafb3cee4840e4f6f)) 184 | 185 | - **deps**: Update 186 | ([`1d2c82e`](https://github.com/iwpnd/fastapi-key-auth/commit/1d2c82e3e2f29b838694118f3bb63e394028f2ca)) 187 | 188 | ### Performance Improvements 189 | 190 | - Bump fastapi v0.111.0 191 | ([`be7be5d`](https://github.com/iwpnd/fastapi-key-auth/commit/be7be5d5b5e2c3c06e8d3ac7a3dbd89fd3e4dfa1)) 192 | 193 | 194 | ## v0.15.2 (2024-02-06) 195 | 196 | ### Chores 197 | 198 | - Ruff pyproject config 199 | ([`8d6305b`](https://github.com/iwpnd/fastapi-key-auth/commit/8d6305bd28655088eb60de9ae27dbf0b01e1141d)) 200 | 201 | - **deps**: Update 202 | ([`38072fc`](https://github.com/iwpnd/fastapi-key-auth/commit/38072fc2e3d92cf4ead3bdf1c927471e97ea61e0)) 203 | 204 | ### Performance Improvements 205 | 206 | - Update fastapi dependency 207 | ([`2edd58c`](https://github.com/iwpnd/fastapi-key-auth/commit/2edd58cce1c0c0f08a3e840fd59a9f9f17d12c63)) 208 | 209 | 210 | ## v0.15.1 (2024-01-09) 211 | 212 | ### Bug Fixes 213 | 214 | - Python-semantic-release versioning 215 | ([`ec1756b`](https://github.com/iwpnd/fastapi-key-auth/commit/ec1756b2db930ce46ac1bdc96df21f337c68e0f4)) 216 | 217 | 218 | ## v0.15.0 (2024-01-09) 219 | 220 | ### Features 221 | 222 | - Export helper utils 223 | ([`466b963`](https://github.com/iwpnd/fastapi-key-auth/commit/466b9632618542245120f8bb4ad1669fb2b2674a)) 224 | 225 | and trigger python-semantic-release to pypi O_O 226 | 227 | 228 | ## v0.14.1 (2024-01-09) 229 | 230 | ### Chores 231 | 232 | - Add config parser options for semantic release 233 | ([`86275ca`](https://github.com/iwpnd/fastapi-key-auth/commit/86275ca8be2b1d6a34178d229869d2ea6cf51c06)) 234 | 235 | - Add release step 236 | ([`2937d7a`](https://github.com/iwpnd/fastapi-key-auth/commit/2937d7a04bf19419ca42544a7f318745e4320efe)) 237 | 238 | - Fix release step run on main 239 | ([`9af1d31`](https://github.com/iwpnd/fastapi-key-auth/commit/9af1d31f99013f4c3b051f5abdfa19da636c0937)) 240 | 241 | - Update CHANGELOG.md 242 | ([`d10a710`](https://github.com/iwpnd/fastapi-key-auth/commit/d10a710b2bd40b419690db3b4d9b43f921c65bd0)) 243 | 244 | - **deps**: Bump actions/setup-python from 4 to 5 245 | ([`e9d8277`](https://github.com/iwpnd/fastapi-key-auth/commit/e9d82777b476a95c26305caa999f0b2e0007983e)) 246 | 247 | Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release 248 | notes](https://github.com/actions/setup-python/releases) - 249 | [Commits](https://github.com/actions/setup-python/compare/v4...v5) 250 | 251 | --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production 252 | 253 | update-type: version-update:semver-major ... 254 | 255 | Signed-off-by: dependabot[bot] 256 | 257 | - **deps**: Bump github/codeql-action from 2 to 3 258 | ([`1c016a8`](https://github.com/iwpnd/fastapi-key-auth/commit/1c016a8c58fd036b524cec2a24e2281e7e425001)) 259 | 260 | Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release 261 | notes](https://github.com/github/codeql-action/releases) - 262 | [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - 263 | [Commits](https://github.com/github/codeql-action/compare/v2...v3) 264 | 265 | --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production 266 | 267 | update-type: version-update:semver-major ... 268 | 269 | Signed-off-by: dependabot[bot] 270 | 271 | - **deps**: Pre-commit autoupdate 272 | ([`4b6fa79`](https://github.com/iwpnd/fastapi-key-auth/commit/4b6fa791c01d00b824c4ee8db022d15078003a04)) 273 | 274 | - **deps**: Update 275 | ([`6dad96b`](https://github.com/iwpnd/fastapi-key-auth/commit/6dad96b500f7609f50a37302f6c28ebabae0f7b7)) 276 | 277 | ### Performance Improvements 278 | 279 | - Speed up api key look up, reuse helper functions 280 | ([`745b2e7`](https://github.com/iwpnd/fastapi-key-auth/commit/745b2e7580175549e1e4cad98c1979fcbc6d869b)) 281 | 282 | 283 | ## v0.14.0 (2023-12-23) 284 | 285 | ### Chores 286 | 287 | - Downgrade python-semantic-release 288 | ([`1c266de`](https://github.com/iwpnd/fastapi-key-auth/commit/1c266dee7415f3cbe1d7ff6ee2aad4afe013b396)) 289 | 290 | - Restore 0.12.0 291 | ([`840b417`](https://github.com/iwpnd/fastapi-key-auth/commit/840b41742d7543af31ce95455a39ed08226690a3)) 292 | 293 | - Restore 0.12.0 294 | ([`7ff41f3`](https://github.com/iwpnd/fastapi-key-auth/commit/7ff41f3cccdebcb5d2db93994f68f16611fda1c6)) 295 | 296 | - Update keywords 297 | ([`35a21c1`](https://github.com/iwpnd/fastapi-key-auth/commit/35a21c1e7d31205a40c34e29a6226e308ef6cd92)) 298 | 299 | - **deps**: Bump actions/cache from 3.3.1 to 3.3.2 300 | ([`f1f4d4f`](https://github.com/iwpnd/fastapi-key-auth/commit/f1f4d4f339d4e0c8dce5540a7c7c2ef4d9b165e5)) 301 | 302 | Bumps [actions/cache](https://github.com/actions/cache) from 3.3.1 to 3.3.2. - [Release 303 | notes](https://github.com/actions/cache/releases) - 304 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 305 | [Commits](https://github.com/actions/cache/compare/v3.3.1...v3.3.2) 306 | 307 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 308 | 309 | update-type: version-update:semver-patch ... 310 | 311 | Signed-off-by: dependabot[bot] 312 | 313 | - **deps**: Bump actions/checkout from 3 to 4 314 | ([`d021c65`](https://github.com/iwpnd/fastapi-key-auth/commit/d021c658eb7755ec2d69b23fffbd06dfb4810353)) 315 | 316 | Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release 317 | notes](https://github.com/actions/checkout/releases) - 318 | [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - 319 | [Commits](https://github.com/actions/checkout/compare/v3...v4) 320 | 321 | --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production 322 | 323 | update-type: version-update:semver-major ... 324 | 325 | Signed-off-by: dependabot[bot] 326 | 327 | - **deps**: Bump fastapi from 0.100.0 to 0.100.1 328 | ([`431617b`](https://github.com/iwpnd/fastapi-key-auth/commit/431617b149c6c7628e5020c0d7f27bc1008edd89)) 329 | 330 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.100.0 to 0.100.1. - [Release 331 | notes](https://github.com/tiangolo/fastapi/releases) - 332 | [Commits](https://github.com/tiangolo/fastapi/compare/0.100.0...0.100.1) 333 | 334 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 335 | 336 | update-type: version-update:semver-patch ... 337 | 338 | Signed-off-by: dependabot[bot] 339 | 340 | - **deps**: Bump fastapi from 0.100.1 to 0.101.0 341 | ([`c3e5016`](https://github.com/iwpnd/fastapi-key-auth/commit/c3e5016bbe9e6eb535e922d08df3e8aac25b9b66)) 342 | 343 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.100.1 to 0.101.0. - [Release 344 | notes](https://github.com/tiangolo/fastapi/releases) - 345 | [Commits](https://github.com/tiangolo/fastapi/compare/0.100.1...0.101.0) 346 | 347 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 348 | 349 | update-type: version-update:semver-minor ... 350 | 351 | Signed-off-by: dependabot[bot] 352 | 353 | - **deps**: Bump fastapi from 0.101.0 to 0.101.1 354 | ([`4862399`](https://github.com/iwpnd/fastapi-key-auth/commit/4862399f84bd88002b78d1e59aa0736a16a2d64a)) 355 | 356 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.101.0 to 0.101.1. - [Release 357 | notes](https://github.com/tiangolo/fastapi/releases) - 358 | [Commits](https://github.com/tiangolo/fastapi/compare/0.101.0...0.101.1) 359 | 360 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 361 | 362 | update-type: version-update:semver-patch ... 363 | 364 | Signed-off-by: dependabot[bot] 365 | 366 | - **deps**: Bump fastapi from 0.101.1 to 0.103.0 367 | ([`e0b67bf`](https://github.com/iwpnd/fastapi-key-auth/commit/e0b67bf423298ad0c6cb4e701b73ba630558557e)) 368 | 369 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.101.1 to 0.103.0. - [Release 370 | notes](https://github.com/tiangolo/fastapi/releases) - 371 | [Commits](https://github.com/tiangolo/fastapi/compare/0.101.1...0.103.0) 372 | 373 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 374 | 375 | update-type: version-update:semver-minor ... 376 | 377 | Signed-off-by: dependabot[bot] 378 | 379 | - **deps**: Bump fastapi from 0.103.0 to 0.103.1 380 | ([`7e66d16`](https://github.com/iwpnd/fastapi-key-auth/commit/7e66d161bf3a2284f9bc3608fd1b87698ad4c2bd)) 381 | 382 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.0 to 0.103.1. - [Release 383 | notes](https://github.com/tiangolo/fastapi/releases) - 384 | [Commits](https://github.com/tiangolo/fastapi/compare/0.103.0...0.103.1) 385 | 386 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 387 | 388 | update-type: version-update:semver-patch ... 389 | 390 | Signed-off-by: dependabot[bot] 391 | 392 | - **deps**: Bump fastapi from 0.103.1 to 0.103.2 393 | ([`81a1e67`](https://github.com/iwpnd/fastapi-key-auth/commit/81a1e67f9a414abb195d92225354043405185820)) 394 | 395 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.1 to 0.103.2. - [Release 396 | notes](https://github.com/tiangolo/fastapi/releases) - 397 | [Commits](https://github.com/tiangolo/fastapi/compare/0.103.1...0.103.2) 398 | 399 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 400 | 401 | update-type: version-update:semver-patch ... 402 | 403 | Signed-off-by: dependabot[bot] 404 | 405 | - **deps**: Bump fastapi from 0.103.2 to 0.104.1 406 | ([`8adf7bb`](https://github.com/iwpnd/fastapi-key-auth/commit/8adf7bb229e0434155f69dc90fc5a8dcf27be71e)) 407 | 408 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.2 to 0.104.1. - [Release 409 | notes](https://github.com/tiangolo/fastapi/releases) - 410 | [Commits](https://github.com/tiangolo/fastapi/compare/0.103.2...0.104.1) 411 | 412 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 413 | 414 | update-type: version-update:semver-minor ... 415 | 416 | Signed-off-by: dependabot[bot] 417 | 418 | - **deps**: Bump fastapi from 0.97.0 to 0.98.0 419 | ([`7228763`](https://github.com/iwpnd/fastapi-key-auth/commit/7228763fec0e7b59f0625171d38dce68db071aa6)) 420 | 421 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.97.0 to 0.98.0. - [Release 422 | notes](https://github.com/tiangolo/fastapi/releases) - 423 | [Commits](https://github.com/tiangolo/fastapi/compare/0.97.0...0.98.0) 424 | 425 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 426 | 427 | update-type: version-update:semver-minor ... 428 | 429 | Signed-off-by: dependabot[bot] 430 | 431 | - **deps**: Bump fastapi from 0.98.0 to 0.99.1 432 | ([`a7fbf41`](https://github.com/iwpnd/fastapi-key-auth/commit/a7fbf41ae65e5d9b769088beb7f619178749944d)) 433 | 434 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.98.0 to 0.99.1. - [Release 435 | notes](https://github.com/tiangolo/fastapi/releases) - 436 | [Commits](https://github.com/tiangolo/fastapi/compare/0.98.0...0.99.1) 437 | 438 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 439 | 440 | update-type: version-update:semver-minor ... 441 | 442 | Signed-off-by: dependabot[bot] 443 | 444 | - **deps**: Bump fastapi from 0.99.1 to 0.100.0 445 | ([`739ed7f`](https://github.com/iwpnd/fastapi-key-auth/commit/739ed7f9ff6ffe819bdd3d3664045d82a19262e0)) 446 | 447 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.99.1 to 0.100.0. - [Release 448 | notes](https://github.com/tiangolo/fastapi/releases) - 449 | [Commits](https://github.com/tiangolo/fastapi/compare/0.99.1...0.100.0) 450 | 451 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 452 | 453 | update-type: version-update:semver-minor ... 454 | 455 | Signed-off-by: dependabot[bot] 456 | 457 | ### Features 458 | 459 | - Drop 3.8 support 460 | ([`a4596bb`](https://github.com/iwpnd/fastapi-key-auth/commit/a4596bb062f008e766b1558d0051613dc6492655)) 461 | 462 | 463 | ## v0.12.0 (2023-06-13) 464 | 465 | ### Bug Fixes 466 | 467 | - Empty api_key passing authentication 468 | ([`c30376e`](https://github.com/iwpnd/fastapi-key-auth/commit/c30376e68c605431c7d11e64dcacf6792baface8)) 469 | 470 | ### Chores 471 | 472 | - Bump fastapi dependency 473 | ([`386c4f7`](https://github.com/iwpnd/fastapi-key-auth/commit/386c4f7226079a61a15ad528e3c2065da962946c)) 474 | 475 | - **deps**: Bump fastapi from 0.95.0 to 0.95.1 476 | ([`c09d826`](https://github.com/iwpnd/fastapi-key-auth/commit/c09d826c674beeee27c792d35f8b70d216a51a87)) 477 | 478 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.95.0 to 0.95.1. - [Release 479 | notes](https://github.com/tiangolo/fastapi/releases) - 480 | [Commits](https://github.com/tiangolo/fastapi/compare/0.95.0...0.95.1) 481 | 482 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 483 | 484 | update-type: version-update:semver-patch ... 485 | 486 | Signed-off-by: dependabot[bot] 487 | 488 | 489 | ## v0.11.0 (2023-04-11) 490 | 491 | ### Chores 492 | 493 | - Use ruff instead of flake8 in precommit 494 | ([`0071eb5`](https://github.com/iwpnd/fastapi-key-auth/commit/0071eb505f93a7f6092fb2cef1aa46ede67ba95c)) 495 | 496 | - **deps**: Bump actions/cache from 3.2.6 to 3.3.1 497 | ([`f276fd2`](https://github.com/iwpnd/fastapi-key-auth/commit/f276fd21c76a6661136b794300d26ec75c50d6c1)) 498 | 499 | Bumps [actions/cache](https://github.com/actions/cache) from 3.2.6 to 3.3.1. - [Release 500 | notes](https://github.com/actions/cache/releases) - 501 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 502 | [Commits](https://github.com/actions/cache/compare/v3.2.6...v3.3.1) 503 | 504 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 505 | 506 | update-type: version-update:semver-minor ... 507 | 508 | Signed-off-by: dependabot[bot] 509 | 510 | ### Features 511 | 512 | - Drop support for python 3.7 513 | ([`2dc24ea`](https://github.com/iwpnd/fastapi-key-auth/commit/2dc24ea7742ad48a66d9e776b0958345cfff8cc1)) 514 | 515 | 516 | ## v0.10.2 (2023-03-31) 517 | 518 | ### Bug Fixes 519 | 520 | - Dependencies 521 | ([`14582ca`](https://github.com/iwpnd/fastapi-key-auth/commit/14582ca6c3e3369d415d4f78547af1f195e3fd30)) 522 | 523 | 524 | ## v0.10.1 (2023-03-08) 525 | 526 | 527 | ## v0.10.0 (2023-03-08) 528 | 529 | ### Chores 530 | 531 | - **deps**: Bump actions/cache from 3.2.4 to 3.2.6 532 | ([`120a3bc`](https://github.com/iwpnd/fastapi-key-auth/commit/120a3bc6d1125320565ccc9cd45a403871611928)) 533 | 534 | Bumps [actions/cache](https://github.com/actions/cache) from 3.2.4 to 3.2.6. - [Release 535 | notes](https://github.com/actions/cache/releases) - 536 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 537 | [Commits](https://github.com/actions/cache/compare/v3.2.4...v3.2.6) 538 | 539 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 540 | 541 | update-type: version-update:semver-patch ... 542 | 543 | Signed-off-by: dependabot[bot] 544 | 545 | 546 | ## v0.9.0 (2023-02-15) 547 | 548 | ### Chores 549 | 550 | - Autoupdate pre-commit hooks 551 | ([`47c8fb0`](https://github.com/iwpnd/fastapi-key-auth/commit/47c8fb00057bc583816d4ef009404827c0ddb3d6)) 552 | 553 | - Lockfile maintenance 554 | ([`b8a5225`](https://github.com/iwpnd/fastapi-key-auth/commit/b8a522518f6de6d6e5dbf9f3ac9b11ef60846b56)) 555 | 556 | - **deps**: Bump actions/cache from 3.0.11 to 3.2.2 557 | ([`86ed621`](https://github.com/iwpnd/fastapi-key-auth/commit/86ed6215a903f876085336887a5c953afa35cf58)) 558 | 559 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.11 to 3.2.2. - [Release 560 | notes](https://github.com/actions/cache/releases) - 561 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 562 | [Commits](https://github.com/actions/cache/compare/v3.0.11...v3.2.2) 563 | 564 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 565 | 566 | update-type: version-update:semver-minor ... 567 | 568 | Signed-off-by: dependabot[bot] 569 | 570 | - **deps**: Bump actions/cache from 3.0.9 to 3.0.11 571 | ([`3f167d5`](https://github.com/iwpnd/fastapi-key-auth/commit/3f167d561646831b3493c9fa6d37668189b4e8c1)) 572 | 573 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.9 to 3.0.11. - [Release 574 | notes](https://github.com/actions/cache/releases) - 575 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 576 | [Commits](https://github.com/actions/cache/compare/v3.0.9...v3.0.11) 577 | 578 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 579 | 580 | update-type: version-update:semver-patch ... 581 | 582 | Signed-off-by: dependabot[bot] 583 | 584 | - **deps**: Bump actions/cache from 3.2.2 to 3.2.4 585 | ([`d80d5a4`](https://github.com/iwpnd/fastapi-key-auth/commit/d80d5a4bc5abd7a7c240a0bbc01546c482d30016)) 586 | 587 | Bumps [actions/cache](https://github.com/actions/cache) from 3.2.2 to 3.2.4. - [Release 588 | notes](https://github.com/actions/cache/releases) - 589 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 590 | [Commits](https://github.com/actions/cache/compare/v3.2.2...v3.2.4) 591 | 592 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 593 | 594 | update-type: version-update:semver-patch ... 595 | 596 | Signed-off-by: dependabot[bot] 597 | 598 | ### Documentation 599 | 600 | - Fix typo 601 | ([`82ef892`](https://github.com/iwpnd/fastapi-key-auth/commit/82ef892c373a5844915c020b861a679c8fb3a7d3)) 602 | 603 | 604 | ## v0.8.0 (2022-10-31) 605 | 606 | ### Chores 607 | 608 | - Update pre-commit hooks 609 | ([`3ad1c7e`](https://github.com/iwpnd/fastapi-key-auth/commit/3ad1c7e229de017afcf9eb0c4820a818e21658b0)) 610 | 611 | ### Features 612 | 613 | - Default key pattern 614 | ([`72bf29b`](https://github.com/iwpnd/fastapi-key-auth/commit/72bf29bd93391eb81a538e8b7ea1d22782e274c4)) 615 | 616 | ### Refactoring 617 | 618 | - Check key_pattern once 619 | ([`d9877c5`](https://github.com/iwpnd/fastapi-key-auth/commit/d9877c59a3a4e9876cad7d05f79c40bb8c6cd9ba)) 620 | 621 | 622 | ## v0.7.6 (2022-10-01) 623 | 624 | ### Chores 625 | 626 | - Bump fastapi dependency 627 | ([`a0837c9`](https://github.com/iwpnd/fastapi-key-auth/commit/a0837c9deb4acf7ca42570dc335a68960291c5c3)) 628 | 629 | - Update pre-commit hooks 630 | ([`c517644`](https://github.com/iwpnd/fastapi-key-auth/commit/c5176448e759bb54f491cd136ba733dd848db417)) 631 | 632 | - **deps**: Bump actions/cache from 3.0.2 to 3.0.3 633 | ([`924461e`](https://github.com/iwpnd/fastapi-key-auth/commit/924461e9001cb719385edd6e777b9aa98405c8cd)) 634 | 635 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.2 to 3.0.3. - [Release 636 | notes](https://github.com/actions/cache/releases) - 637 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 638 | [Commits](https://github.com/actions/cache/compare/v3.0.2...v3.0.3) 639 | 640 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 641 | 642 | update-type: version-update:semver-patch ... 643 | 644 | Signed-off-by: dependabot[bot] 645 | 646 | - **deps**: Bump actions/cache from 3.0.3 to 3.0.4 647 | ([`c60ba29`](https://github.com/iwpnd/fastapi-key-auth/commit/c60ba296001fbdc1bcd712aae0fd8df1269dcfce)) 648 | 649 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.3 to 3.0.4. - [Release 650 | notes](https://github.com/actions/cache/releases) - 651 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 652 | [Commits](https://github.com/actions/cache/compare/v3.0.3...v3.0.4) 653 | 654 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 655 | 656 | update-type: version-update:semver-patch ... 657 | 658 | Signed-off-by: dependabot[bot] 659 | 660 | - **deps**: Bump actions/cache from 3.0.4 to 3.0.5 661 | ([`af0e6dd`](https://github.com/iwpnd/fastapi-key-auth/commit/af0e6ddb773c188038134287c8f205644de4bdc1)) 662 | 663 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.4 to 3.0.5. - [Release 664 | notes](https://github.com/actions/cache/releases) - 665 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 666 | [Commits](https://github.com/actions/cache/compare/v3.0.4...v3.0.5) 667 | 668 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 669 | 670 | update-type: version-update:semver-patch ... 671 | 672 | Signed-off-by: dependabot[bot] 673 | 674 | - **deps**: Bump actions/cache from 3.0.5 to 3.0.8 675 | ([`73a3b9f`](https://github.com/iwpnd/fastapi-key-auth/commit/73a3b9f2e3c2de3f9b1d050a791ceb58841da01f)) 676 | 677 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.5 to 3.0.8. - [Release 678 | notes](https://github.com/actions/cache/releases) - 679 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 680 | [Commits](https://github.com/actions/cache/compare/v3.0.5...v3.0.8) 681 | 682 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 683 | 684 | update-type: version-update:semver-patch ... 685 | 686 | Signed-off-by: dependabot[bot] 687 | 688 | - **deps**: Bump actions/cache from 3.0.8 to 3.0.9 689 | ([`cccfc45`](https://github.com/iwpnd/fastapi-key-auth/commit/cccfc45af5ef46bb7ddab09fb6967e3b10e2007e)) 690 | 691 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.8 to 3.0.9. - [Release 692 | notes](https://github.com/actions/cache/releases) - 693 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 694 | [Commits](https://github.com/actions/cache/compare/v3.0.8...v3.0.9) 695 | 696 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 697 | 698 | update-type: version-update:semver-patch ... 699 | 700 | Signed-off-by: dependabot[bot] 701 | 702 | - **deps**: Bump actions/setup-python from 3 to 4 703 | ([`f8d93f6`](https://github.com/iwpnd/fastapi-key-auth/commit/f8d93f67db4fcf11662c0b1f510a24ba87895dbc)) 704 | 705 | Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4. - [Release 706 | notes](https://github.com/actions/setup-python/releases) - 707 | [Commits](https://github.com/actions/setup-python/compare/v3...v4) 708 | 709 | --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production 710 | 711 | update-type: version-update:semver-major ... 712 | 713 | Signed-off-by: dependabot[bot] 714 | 715 | - **deps**: Bump fastapi from 0.78.0 to 0.79.0 716 | ([`f5a76c1`](https://github.com/iwpnd/fastapi-key-auth/commit/f5a76c1112add51164b13178878e0d4dd55b66e5)) 717 | 718 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.78.0 to 0.79.0. - [Release 719 | notes](https://github.com/tiangolo/fastapi/releases) - 720 | [Commits](https://github.com/tiangolo/fastapi/compare/0.78.0...0.79.0) 721 | 722 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 723 | 724 | update-type: version-update:semver-minor ... 725 | 726 | Signed-off-by: dependabot[bot] 727 | 728 | - **deps**: Bump fastapi from 0.79.0 to 0.79.1 729 | ([`a3394bd`](https://github.com/iwpnd/fastapi-key-auth/commit/a3394bd6fc23f5e9192158bd02f2fe7d75ce35e0)) 730 | 731 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.79.0 to 0.79.1. - [Release 732 | notes](https://github.com/tiangolo/fastapi/releases) - 733 | [Commits](https://github.com/tiangolo/fastapi/compare/0.79.0...0.79.1) 734 | 735 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 736 | 737 | update-type: version-update:semver-patch ... 738 | 739 | Signed-off-by: dependabot[bot] 740 | 741 | - **deps**: Bump fastapi from 0.79.1 to 0.80.0 742 | ([`bf2f854`](https://github.com/iwpnd/fastapi-key-auth/commit/bf2f854e8b83fe968fc8fc79bdd0948940593615)) 743 | 744 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.79.1 to 0.80.0. - [Release 745 | notes](https://github.com/tiangolo/fastapi/releases) - 746 | [Commits](https://github.com/tiangolo/fastapi/compare/0.79.1...0.80.0) 747 | 748 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 749 | 750 | update-type: version-update:semver-minor ... 751 | 752 | Signed-off-by: dependabot[bot] 753 | 754 | - **deps**: Bump fastapi from 0.80.0 to 0.81.0 755 | ([`dbfd1dc`](https://github.com/iwpnd/fastapi-key-auth/commit/dbfd1dca66e3e4ecc71c6d5d8ca2a31746e0f881)) 756 | 757 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.80.0 to 0.81.0. - [Release 758 | notes](https://github.com/tiangolo/fastapi/releases) - 759 | [Commits](https://github.com/tiangolo/fastapi/compare/0.80.0...0.81.0) 760 | 761 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 762 | 763 | update-type: version-update:semver-minor ... 764 | 765 | Signed-off-by: dependabot[bot] 766 | 767 | - **deps**: Bump fastapi from 0.81.0 to 0.82.0 768 | ([`8ef7cac`](https://github.com/iwpnd/fastapi-key-auth/commit/8ef7cac515dbd2531ea612a2f9a815f361a120ad)) 769 | 770 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.81.0 to 0.82.0. - [Release 771 | notes](https://github.com/tiangolo/fastapi/releases) - 772 | [Commits](https://github.com/tiangolo/fastapi/compare/0.81.0...0.82.0) 773 | 774 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 775 | 776 | update-type: version-update:semver-minor ... 777 | 778 | Signed-off-by: dependabot[bot] 779 | 780 | - **deps**: Bump fastapi from 0.82.0 to 0.83.0 781 | ([`782e6ea`](https://github.com/iwpnd/fastapi-key-auth/commit/782e6eaec56a466703211afd48df31419fc350a1)) 782 | 783 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.82.0 to 0.83.0. - [Release 784 | notes](https://github.com/tiangolo/fastapi/releases) - 785 | [Commits](https://github.com/tiangolo/fastapi/compare/0.82.0...0.83.0) 786 | 787 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 788 | 789 | update-type: version-update:semver-minor ... 790 | 791 | Signed-off-by: dependabot[bot] 792 | 793 | - **deps**: Bump fastapi from 0.83.0 to 0.84.0 794 | ([`64d3bb4`](https://github.com/iwpnd/fastapi-key-auth/commit/64d3bb4d171a8537873c35ce289ff0cad03c0b58)) 795 | 796 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.83.0 to 0.84.0. - [Release 797 | notes](https://github.com/tiangolo/fastapi/releases) - 798 | [Commits](https://github.com/tiangolo/fastapi/compare/0.83.0...0.84.0) 799 | 800 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 801 | 802 | update-type: version-update:semver-minor ... 803 | 804 | Signed-off-by: dependabot[bot] 805 | 806 | 807 | ## v0.7.5 (2022-05-16) 808 | 809 | ### Chores 810 | 811 | - Bump fastapi dependency 812 | ([`9a20d77`](https://github.com/iwpnd/fastapi-key-auth/commit/9a20d77f2ba20f1127319002e5706af75df1c30d)) 813 | 814 | 815 | ## v0.7.4 (2022-05-10) 816 | 817 | ### Chores 818 | 819 | - Bump fastapi and starlette 820 | ([`74c4aca`](https://github.com/iwpnd/fastapi-key-auth/commit/74c4acab1d27cd6b479cadbe04f006610e27db0d)) 821 | 822 | - **deps**: Bump actions/cache from 3.0.1 to 3.0.2 823 | ([`2402b74`](https://github.com/iwpnd/fastapi-key-auth/commit/2402b745f4dc19c152f4c7bac557c1ff981626bc)) 824 | 825 | Bumps [actions/cache](https://github.com/actions/cache) from 3.0.1 to 3.0.2. - [Release 826 | notes](https://github.com/actions/cache/releases) - 827 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 828 | [Commits](https://github.com/actions/cache/compare/v3.0.1...v3.0.2) 829 | 830 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 831 | 832 | update-type: version-update:semver-patch ... 833 | 834 | Signed-off-by: dependabot[bot] 835 | 836 | - **deps**: Bump github/codeql-action from 1 to 2 837 | ([`c6b1b88`](https://github.com/iwpnd/fastapi-key-auth/commit/c6b1b8882433eaec8d30bef3fefdbab053464167)) 838 | 839 | Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2. - [Release 840 | notes](https://github.com/github/codeql-action/releases) - 841 | [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - 842 | [Commits](https://github.com/github/codeql-action/compare/v1...v2) 843 | 844 | --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production 845 | 846 | update-type: version-update:semver-major ... 847 | 848 | Signed-off-by: dependabot[bot] 849 | 850 | 851 | ## v0.7.3 (2022-04-28) 852 | 853 | ### Bug Fixes 854 | 855 | - Fastapi dependency range 856 | ([`8c7d5df`](https://github.com/iwpnd/fastapi-key-auth/commit/8c7d5dfd97c86d34c9c6068b7b826b2fdabcbd3c)) 857 | 858 | 859 | ## v0.7.2 (2022-04-28) 860 | 861 | ### Bug Fixes 862 | 863 | - Fastapi dependency 864 | ([`40929de`](https://github.com/iwpnd/fastapi-key-auth/commit/40929de336049d51bf1e06e4003e95aaaaa7a11c)) 865 | 866 | ### Chores 867 | 868 | - **deps**: Bump actions/cache from 2.1.7 to 3.0.1 869 | ([`66c823b`](https://github.com/iwpnd/fastapi-key-auth/commit/66c823ba5f56c2e84a58d3cb04d3f66a3e43181d)) 870 | 871 | Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3.0.1. - [Release 872 | notes](https://github.com/actions/cache/releases) - 873 | [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - 874 | [Commits](https://github.com/actions/cache/compare/v2.1.7...v3.0.1) 875 | 876 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 877 | 878 | update-type: version-update:semver-major ... 879 | 880 | Signed-off-by: dependabot[bot] 881 | 882 | - **deps**: Bump actions/checkout from 2 to 3 883 | ([`8d359d8`](https://github.com/iwpnd/fastapi-key-auth/commit/8d359d8019a61887a6905d3d996c6a2f55ed3738)) 884 | 885 | Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release 886 | notes](https://github.com/actions/checkout/releases) - 887 | [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - 888 | [Commits](https://github.com/actions/checkout/compare/v2...v3) 889 | 890 | --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production 891 | 892 | update-type: version-update:semver-major ... 893 | 894 | Signed-off-by: dependabot[bot] 895 | 896 | - **deps**: Bump actions/setup-python from 2 to 3 897 | ([`f142dee`](https://github.com/iwpnd/fastapi-key-auth/commit/f142dee0c37c8ef9fbfd22a97160cc1ef1d5b188)) 898 | 899 | Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3. - [Release 900 | notes](https://github.com/actions/setup-python/releases) - 901 | [Commits](https://github.com/actions/setup-python/compare/v2...v3) 902 | 903 | --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production 904 | 905 | update-type: version-update:semver-major ... 906 | 907 | Signed-off-by: dependabot[bot] 908 | 909 | - **deps**: Bump fastapi from 0.71.0 to 0.72.0 910 | ([`469a5ac`](https://github.com/iwpnd/fastapi-key-auth/commit/469a5aca3eb7a2bce3fb14cea6c578c6e6867ae2)) 911 | 912 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.71.0 to 0.72.0. - [Release 913 | notes](https://github.com/tiangolo/fastapi/releases) - 914 | [Commits](https://github.com/tiangolo/fastapi/compare/0.71.0...0.72.0) 915 | 916 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 917 | 918 | update-type: version-update:semver-minor ... 919 | 920 | Signed-off-by: dependabot[bot] 921 | 922 | - **deps**: Bump fastapi from 0.72.0 to 0.73.0 923 | ([`df01021`](https://github.com/iwpnd/fastapi-key-auth/commit/df01021885c6cba750982e605f988e457f92807d)) 924 | 925 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.72.0 to 0.73.0. - [Release 926 | notes](https://github.com/tiangolo/fastapi/releases) - 927 | [Commits](https://github.com/tiangolo/fastapi/compare/0.72.0...0.73.0) 928 | 929 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 930 | 931 | update-type: version-update:semver-minor ... 932 | 933 | Signed-off-by: dependabot[bot] 934 | 935 | - **deps**: Bump fastapi from 0.73.0 to 0.74.0 936 | ([`913c145`](https://github.com/iwpnd/fastapi-key-auth/commit/913c145b29dd94ad63629b4bcccee96b68b2418a)) 937 | 938 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.73.0 to 0.74.0. - [Release 939 | notes](https://github.com/tiangolo/fastapi/releases) - 940 | [Commits](https://github.com/tiangolo/fastapi/compare/0.73.0...0.74.0) 941 | 942 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 943 | 944 | update-type: version-update:semver-minor ... 945 | 946 | Signed-off-by: dependabot[bot] 947 | 948 | - **deps**: Bump fastapi from 0.74.0 to 0.74.1 949 | ([`ed77f6e`](https://github.com/iwpnd/fastapi-key-auth/commit/ed77f6ebb1e5462a0f5df98f26682ba04e2315a4)) 950 | 951 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.74.0 to 0.74.1. - [Release 952 | notes](https://github.com/tiangolo/fastapi/releases) - 953 | [Commits](https://github.com/tiangolo/fastapi/compare/0.74.0...0.74.1) 954 | 955 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 956 | 957 | update-type: version-update:semver-patch ... 958 | 959 | Signed-off-by: dependabot[bot] 960 | 961 | - **deps**: Bump fastapi from 0.74.1 to 0.75.0 962 | ([`8ecd5ee`](https://github.com/iwpnd/fastapi-key-auth/commit/8ecd5eec12fe976c64ae3151be5ddc7ec7db8b3d)) 963 | 964 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.74.1 to 0.75.0. - [Release 965 | notes](https://github.com/tiangolo/fastapi/releases) - 966 | [Commits](https://github.com/tiangolo/fastapi/compare/0.74.1...0.75.0) 967 | 968 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 969 | 970 | update-type: version-update:semver-minor ... 971 | 972 | Signed-off-by: dependabot[bot] 973 | 974 | - **deps**: Bump fastapi from 0.75.0 to 0.75.1 975 | ([`e52a7d9`](https://github.com/iwpnd/fastapi-key-auth/commit/e52a7d97c556523e14f6f735ee2e40665bee9d93)) 976 | 977 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.75.0 to 0.75.1. - [Release 978 | notes](https://github.com/tiangolo/fastapi/releases) - 979 | [Commits](https://github.com/tiangolo/fastapi/compare/0.75.0...0.75.1) 980 | 981 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 982 | 983 | update-type: version-update:semver-patch ... 984 | 985 | Signed-off-by: dependabot[bot] 986 | 987 | - **deps**: Bump fastapi from 0.75.1 to 0.75.2 988 | ([`ae74c99`](https://github.com/iwpnd/fastapi-key-auth/commit/ae74c99dc940f9ec8206663b9f83dce971dfd2f4)) 989 | 990 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.75.1 to 0.75.2. - [Release 991 | notes](https://github.com/tiangolo/fastapi/releases) - 992 | [Commits](https://github.com/tiangolo/fastapi/compare/0.75.1...0.75.2) 993 | 994 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 995 | 996 | update-type: version-update:semver-patch ... 997 | 998 | Signed-off-by: dependabot[bot] 999 | 1000 | 1001 | ## v0.7.1 (2022-01-11) 1002 | 1003 | ### Chores 1004 | 1005 | - Add codeql 1006 | ([`39a880f`](https://github.com/iwpnd/fastapi-key-auth/commit/39a880fa6c94ee1dc487502657c1b9fa4425112e)) 1007 | 1008 | - Update fastapi and starlette dependencies 1009 | ([`83c2e14`](https://github.com/iwpnd/fastapi-key-auth/commit/83c2e14fc64febdf3c7d26455be33aa65d757e68)) 1010 | 1011 | - **deps**: Bump actions/cache from 2.1.6 to 2.1.7 1012 | ([`39a743e`](https://github.com/iwpnd/fastapi-key-auth/commit/39a743ec299356aa3b9e0b3f72008ad44d6bf8a9)) 1013 | 1014 | Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7. - [Release 1015 | notes](https://github.com/actions/cache/releases) - 1016 | [Commits](https://github.com/actions/cache/compare/v2.1.6...v2.1.7) 1017 | 1018 | --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production 1019 | 1020 | update-type: version-update:semver-patch ... 1021 | 1022 | Signed-off-by: dependabot[bot] 1023 | 1024 | - **deps**: Bump fastapi from 0.70.0 to 0.70.1 1025 | ([`93a3b02`](https://github.com/iwpnd/fastapi-key-auth/commit/93a3b02cbee301e50c4f4f519bb22af3bab5de09)) 1026 | 1027 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.70.0 to 0.70.1. - [Release 1028 | notes](https://github.com/tiangolo/fastapi/releases) - 1029 | [Commits](https://github.com/tiangolo/fastapi/compare/0.70.0...0.70.1) 1030 | 1031 | --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production 1032 | 1033 | update-type: version-update:semver-patch ... 1034 | 1035 | Signed-off-by: dependabot[bot] 1036 | 1037 | - **deps**: Bump snok/install-poetry from 1.2 to 1.3 1038 | ([`005ab5b`](https://github.com/iwpnd/fastapi-key-auth/commit/005ab5b6f9ee34bcf3856fd97a7d05bc1797d1eb)) 1039 | 1040 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from 1.2 to 1.3. - [Release 1041 | notes](https://github.com/snok/install-poetry/releases) - 1042 | [Commits](https://github.com/snok/install-poetry/compare/v1.2...v1.3) 1043 | 1044 | --- updated-dependencies: - dependency-name: snok/install-poetry dependency-type: direct:production 1045 | 1046 | update-type: version-update:semver-minor ... 1047 | 1048 | Signed-off-by: dependabot[bot] 1049 | 1050 | ### Documentation 1051 | 1052 | - Update changelog 1053 | ([`99ffa7b`](https://github.com/iwpnd/fastapi-key-auth/commit/99ffa7b9ccf8c4468a852b46f0991abcee0f4b6e)) 1054 | 1055 | 1056 | ## v0.7.0 (2021-10-08) 1057 | 1058 | ### Chores 1059 | 1060 | - Add python-semantic-release 1061 | ([`6db94e5`](https://github.com/iwpnd/fastapi-key-auth/commit/6db94e5bbf625f7fcc69be3118cad12b0307497a)) 1062 | 1063 | - Fix poe task 1064 | ([`53717a1`](https://github.com/iwpnd/fastapi-key-auth/commit/53717a155f3ce72d8816b5e3d66885407883229f)) 1065 | 1066 | - Update dev dependencies 1067 | ([`95348a5`](https://github.com/iwpnd/fastapi-key-auth/commit/95348a5cf5ef3766b1ec4b59dd50051ce9a90572)) 1068 | 1069 | - **deps**: Bump actions/cache from 2.1.5 to 2.1.6 1070 | ([`2403201`](https://github.com/iwpnd/fastapi-key-auth/commit/2403201eb5e884fc998b606bda79d6743180821c)) 1071 | 1072 | Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6. - [Release 1073 | notes](https://github.com/actions/cache/releases) - 1074 | [Commits](https://github.com/actions/cache/compare/v2.1.5...v2.1.6) 1075 | 1076 | Signed-off-by: dependabot[bot] 1077 | 1078 | - **deps**: Bump fastapi from 0.63.0 to 0.64.0 1079 | ([`a7c0e09`](https://github.com/iwpnd/fastapi-key-auth/commit/a7c0e0930455b0d38bd818de9fde7b88361357f8)) 1080 | 1081 | Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.63.0 to 0.64.0. - [Release 1082 | notes](https://github.com/tiangolo/fastapi/releases) - 1083 | [Commits](https://github.com/tiangolo/fastapi/compare/0.63.0...0.64.0) 1084 | 1085 | Signed-off-by: dependabot[bot] 1086 | 1087 | - **deps**: Bump snok/install-poetry from 1.1.4 to 1.1.6 1088 | ([`971206e`](https://github.com/iwpnd/fastapi-key-auth/commit/971206ededd8d80a3438c6a6c58f98e2642cec11)) 1089 | 1090 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from 1.1.4 to 1.1.6. - [Release 1091 | notes](https://github.com/snok/install-poetry/releases) - 1092 | [Commits](https://github.com/snok/install-poetry/compare/v1.1.4...v1.1.6) 1093 | 1094 | Signed-off-by: dependabot[bot] 1095 | 1096 | - **deps**: Bump snok/install-poetry from 1.1.6 to 1.1.7 1097 | ([`a5e006b`](https://github.com/iwpnd/fastapi-key-auth/commit/a5e006bd8df02f7a50790e3623866b27bf204849)) 1098 | 1099 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from 1.1.6 to 1.1.7. - [Release 1100 | notes](https://github.com/snok/install-poetry/releases) - 1101 | [Commits](https://github.com/snok/install-poetry/compare/v1.1.6...v1.1.7) 1102 | 1103 | --- updated-dependencies: - dependency-name: snok/install-poetry dependency-type: direct:production 1104 | 1105 | update-type: version-update:semver-patch ... 1106 | 1107 | Signed-off-by: dependabot[bot] 1108 | 1109 | - **deps**: Bump snok/install-poetry from 1.1.7 to 1.1.8 1110 | ([`49a7705`](https://github.com/iwpnd/fastapi-key-auth/commit/49a77052a372d241ce29a7bb33d68493ac09b2d3)) 1111 | 1112 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from 1.1.7 to 1.1.8. - [Release 1113 | notes](https://github.com/snok/install-poetry/releases) - 1114 | [Commits](https://github.com/snok/install-poetry/compare/v1.1.7...v1.1.8) 1115 | 1116 | --- updated-dependencies: - dependency-name: snok/install-poetry dependency-type: direct:production 1117 | 1118 | update-type: version-update:semver-patch ... 1119 | 1120 | Signed-off-by: dependabot[bot] 1121 | 1122 | - **deps**: Bump snok/install-poetry from 1.1.8 to 1.2 1123 | ([`84449d1`](https://github.com/iwpnd/fastapi-key-auth/commit/84449d1bc8c17972a7213e9279b78d7874869311)) 1124 | 1125 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from 1.1.8 to 1.2. - [Release 1126 | notes](https://github.com/snok/install-poetry/releases) - 1127 | [Commits](https://github.com/snok/install-poetry/compare/v1.1.8...v1.2) 1128 | 1129 | --- updated-dependencies: - dependency-name: snok/install-poetry dependency-type: direct:production 1130 | 1131 | update-type: version-update:semver-minor ... 1132 | 1133 | Signed-off-by: dependabot[bot] 1134 | 1135 | ### Features 1136 | 1137 | - **zone-bc-services**: Remove version constrains on starlette and fastapi 1138 | ([`28a4f29`](https://github.com/iwpnd/fastapi-key-auth/commit/28a4f292a596bce8fc451ff4adeb56364a1f0a9e)) 1139 | 1140 | 1141 | ## v0.6.0 (2021-04-25) 1142 | 1143 | ### Chores 1144 | 1145 | - Add license 1146 | ([`dc7503b`](https://github.com/iwpnd/fastapi-key-auth/commit/dc7503bbe9e2e757219d7819b364338b29bedd36)) 1147 | 1148 | - Bump version 🔖 1149 | ([`798b9ef`](https://github.com/iwpnd/fastapi-key-auth/commit/798b9ef2f9c337e50551db9164ebe212c0d35e2a)) 1150 | 1151 | - Fix mypy issues 1152 | ([`db5f843`](https://github.com/iwpnd/fastapi-key-auth/commit/db5f84374f3e96da1012ff04a611276670232a3c)) 1153 | 1154 | - Standardize imports 🎨 1155 | ([`c1f8690`](https://github.com/iwpnd/fastapi-key-auth/commit/c1f869099058565021201044afa3f9417561b0ea)) 1156 | 1157 | ### Documentation 1158 | 1159 | - Update readme 1160 | ([`2a60e06`](https://github.com/iwpnd/fastapi-key-auth/commit/2a60e06105b3ee312f22e226413242482799d8ec)) 1161 | 1162 | - Update readme 📝 1163 | ([`14e0cff`](https://github.com/iwpnd/fastapi-key-auth/commit/14e0cff84b726711780e05bb3aa5983e357ddc6d)) 1164 | 1165 | ### Features 1166 | 1167 | - Add custom key pattern and json response instead of plaintext 1168 | ([`63c5a27`](https://github.com/iwpnd/fastapi-key-auth/commit/63c5a276bbf6724005dc13b9ce4e4d2a32bca99a)) 1169 | 1170 | - Add dependency authorizer ✨ 1171 | ([`7d5cbc4`](https://github.com/iwpnd/fastapi-key-auth/commit/7d5cbc49cf05ffd883843e4a999d0b2d91b9968f)) 1172 | 1173 | 1174 | ## v0.5.0 (2021-04-23) 1175 | 1176 | ### Chores 1177 | 1178 | - Bump version 1179 | ([`7b84a61`](https://github.com/iwpnd/fastapi-key-auth/commit/7b84a61e816173ca8a6c66a92e76d64164eb7fc3)) 1180 | 1181 | ### Features 1182 | 1183 | - Allow regex ^ matches in public_paths 1184 | ([`e5a7dc0`](https://github.com/iwpnd/fastapi-key-auth/commit/e5a7dc0295ebe57fccadccbb362c20554fb598b4)) 1185 | 1186 | 1187 | ## v0.4.1 (2021-04-23) 1188 | 1189 | ### Bug Fixes 1190 | 1191 | - Public_path validation 1192 | ([`2cb8e49`](https://github.com/iwpnd/fastapi-key-auth/commit/2cb8e49f61b3f0b1f56dadd311ae879158d05a6b)) 1193 | 1194 | 1195 | ## v0.4.0 (2021-04-23) 1196 | 1197 | ### Chores 1198 | 1199 | - Bump version 1200 | ([`b6fd811`](https://github.com/iwpnd/fastapi-key-auth/commit/b6fd8111c432d1ee01985eb84d5ea9db44b47ebc)) 1201 | 1202 | ### Documentation 1203 | 1204 | - Fix typo 1205 | ([`2858a5c`](https://github.com/iwpnd/fastapi-key-auth/commit/2858a5cc37aaeca448708707ea777f8a6d10f880)) 1206 | 1207 | ### Features 1208 | 1209 | - Add param to allow public_path without api_key 1210 | ([`1ec619a`](https://github.com/iwpnd/fastapi-key-auth/commit/1ec619a63faee51257651e59ce47717ad2271f26)) 1211 | 1212 | 1213 | ## v0.3.0 (2021-04-21) 1214 | 1215 | ### Bug Fixes 1216 | 1217 | - Pyproject.toml readme 1218 | ([`08ee713`](https://github.com/iwpnd/fastapi-key-auth/commit/08ee7133d81f40a59817627bafce7cc2bf8a1b82)) 1219 | 1220 | ### Chores 1221 | 1222 | - Bump to version 0.3.0 1223 | ([`0cc0b68`](https://github.com/iwpnd/fastapi-key-auth/commit/0cc0b68a95a031d9d93cd4e122c08b58ab9910b3)) 1224 | 1225 | - Bump version 1226 | ([`f976010`](https://github.com/iwpnd/fastapi-key-auth/commit/f976010948312dd16dd2035cae9b82120f176105)) 1227 | 1228 | - Downgrade starlette to 0.13.6 1229 | ([`c479baa`](https://github.com/iwpnd/fastapi-key-auth/commit/c479baa2110a015ea2317d22a14754853c744807)) 1230 | 1231 | - **deps**: Bump actions/cache from v2.1.4 to v2.1.5 1232 | ([`7d062c1`](https://github.com/iwpnd/fastapi-key-auth/commit/7d062c1cefcaf8d21baa277cd9ec0b87720639b0)) 1233 | 1234 | Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5. - [Release 1235 | notes](https://github.com/actions/cache/releases) - 1236 | [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8) 1237 | 1238 | Signed-off-by: dependabot[bot] 1239 | 1240 | - **deps**: Bump snok/install-poetry from v1.1.2 to v1.1.4 1241 | ([`91311f5`](https://github.com/iwpnd/fastapi-key-auth/commit/91311f5059d4241e751e1b1ebea8cc7a8b3dc283)) 1242 | 1243 | Bumps [snok/install-poetry](https://github.com/snok/install-poetry) from v1.1.2 to v1.1.4. - 1244 | [Release notes](https://github.com/snok/install-poetry/releases) - 1245 | [Commits](https://github.com/snok/install-poetry/compare/v1.1.2...fe3362f94a7d193ecae442ec43e79680358051ce) 1246 | 1247 | Signed-off-by: dependabot[bot] 1248 | 1249 | ### Documentation 1250 | 1251 | - Add readme 1252 | ([`c5bfbca`](https://github.com/iwpnd/fastapi-key-auth/commit/c5bfbcaeb61fcc3b306b4aaab47610cd853d0135)) 1253 | 1254 | ### Features 1255 | 1256 | - Initial commit 1257 | ([`a0b6c26`](https://github.com/iwpnd/fastapi-key-auth/commit/a0b6c269120082b39085d8b927640d9f12ac7ae6)) 1258 | 1259 | ### Refactoring 1260 | 1261 | - Move AuthorizerMiddleware to __init__ 1262 | ([`2d1cabc`](https://github.com/iwpnd/fastapi-key-auth/commit/2d1cabcd6dfa6ac91c21afebd19caff504a51436)) 1263 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Benjamin Ramser 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNES FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | S 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: install 2 | install: 3 | @echo "creating venv" 4 | @uv sync 5 | @uv run pre-commit install 6 | 7 | .PHONY: check 8 | check: 9 | @echo "check lockfile consistency" 10 | @uv lock --locked 11 | @echo "run pre-commit hooks" 12 | @uv run pre-commit run -a 13 | @echo "run mypy checks" 14 | @uv run mypy 15 | @echo "check for obsolete dependencies" 16 | @uv run deptry src 17 | 18 | .PHONY: test 19 | test: 20 | @echo "run tests" 21 | @uv run python -m pytest --cov --cov-config=pyproject.toml --cov-report=xml -vv -s 22 | 23 | .PHONY: build 24 | build: clean-build 25 | @echo "creating wheel" 26 | @uvx --from build pyproject-build --installer uv 27 | 28 | .PHONY: clean-build 29 | clean-build: 30 | @echo "remove build artifacts" 31 | @uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None" 32 | 33 | .PHONY: help 34 | help: 35 | @uv run python -c "import re; \ 36 | [[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]" 37 | 38 | .DEFAULT_GOAL := help 39 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "fastapi-key-auth" 3 | version = "0.15.5" 4 | description = "API key validation Middleware" 5 | license = "MIT" 6 | readme = "readme.md" 7 | homepage = "https://github.com/iwpnd/fastapi-key-auth" 8 | repository = "https://github.com/iwpnd/fastapi-key-auth" 9 | keywords = ["fastapi", "api key", "security"] 10 | authors = [{ name = "Benjamin Ramser", email = "iwpnd@posteo.de" }] 11 | requires-python = ">=3.9,<4.0" 12 | classifiers = [ 13 | "Intended Audience :: Developers", 14 | "Programming Language :: Python", 15 | "Programming Language :: Python :: 3", 16 | "Programming Language :: Python :: 3.9", 17 | "Programming Language :: Python :: 3.10", 18 | "Programming Language :: Python :: 3.11", 19 | "Programming Language :: Python :: 3.12", 20 | "Programming Language :: Python :: 3.13", 21 | "Topic :: Software Development :: Libraries :: Python Modules", 22 | ] 23 | 24 | dependencies = [ 25 | "fastapi>=0.100.0", 26 | "starlette>=0.25.0", 27 | ] 28 | 29 | [dependency-groups] 30 | dev = [ 31 | "pytest>=7.2.0", 32 | "pre-commit>=2.20.0", 33 | "tox-uv>=1.11.3", 34 | "deptry>=0.22.0", 35 | "mypy>=0.991", 36 | "pytest-cov>=4.0.0", 37 | "ruff>=0.9.2", 38 | "gitlint>=0.19.1", 39 | "python-semantic-release>=9.21.0", 40 | "httpx>=0.28.1" 41 | ] 42 | 43 | [build-system] 44 | requires = ["hatchling"] 45 | build-backend = "hatchling.build" 46 | 47 | [tool.deptry] 48 | ignore = ["DEP003", "DEP004"] 49 | 50 | [tool.mypy] 51 | files = ["src"] 52 | disallow_untyped_defs = true 53 | disallow_any_unimported = false 54 | no_implicit_optional = true 55 | check_untyped_defs = true 56 | warn_return_any = true 57 | warn_unused_ignores = true 58 | show_error_codes = true 59 | 60 | [tool.pytest.ini_options] 61 | testpaths = ["tests"] 62 | 63 | [tool.ruff] 64 | target-version = "py310" 65 | line-length = 88 66 | fix = true 67 | 68 | [tool.ruff.lint] 69 | select = [ 70 | # flake8-2020 71 | "YTT", 72 | # flake8-bandit 73 | "S", 74 | # flake8-bugbear 75 | "B", 76 | # flake8-builtins 77 | "A", 78 | # flake8-comprehensions 79 | "C4", 80 | # flake8-debugger 81 | "T10", 82 | # flake8-simplify 83 | "SIM", 84 | # isort 85 | "I", 86 | # mccabe 87 | "C90", 88 | # pycodestyle 89 | "E", "W", 90 | # pyflakes 91 | "F", 92 | # pygrep-hooks 93 | "PGH", 94 | # pyupgrade 95 | "UP", 96 | # ruff 97 | "RUF", 98 | # tryceratops 99 | "TRY", 100 | ] 101 | ignore = [ 102 | # LineTooLong 103 | "E501", 104 | # DoNotAssignLambda 105 | "E731", 106 | # long messages outside exception class 107 | "TRY003", 108 | # mutable data structures on init 109 | "B006", 110 | ] 111 | 112 | [tool.ruff.lint.per-file-ignores] 113 | "tests/*" = ["S101"] 114 | "__init__.py" = ["F401", "F403"] 115 | 116 | [tool.ruff.format] 117 | preview = true 118 | 119 | [tool.coverage.report] 120 | skip_empty = true 121 | 122 | [tool.coverage.run] 123 | branch = true 124 | source = ["src"] 125 | 126 | [tool.semantic_release] 127 | version_variables = [ 128 | "src/fastapi_key_auth/__init__.py:__version__", 129 | "pyproject.toml:version", 130 | ] 131 | commit_message = "ci: release v{version}" 132 | branch = "main" 133 | upload_to_release = true 134 | build_command = "pip install uv && uv build" 135 | 136 | [tool.semantic_release.commit_parser_options] 137 | allowed_tags = [ 138 | "build", 139 | "chore", 140 | "ci", 141 | "docs", 142 | "feat", 143 | "fix", 144 | "perf", 145 | "style", 146 | "refactor", 147 | "test", 148 | ] 149 | minor_tags = ["feat"] 150 | patch_tags = ["fix", "perf", "docs"] 151 | 152 | [tool.semantic_release.changelog] 153 | exclude_commit_patterns = [ 154 | "chore\\(release\\):", 155 | "chore\\(deps-dev\\):", 156 | "build\\(deps-dev\\):", 157 | "build\\(deps\\):", 158 | "ci:", 159 | ] 160 | 161 | [tool.basedpyright] 162 | reportUnknownParameterType = false 163 | reportCallInDefaultInitializer = false 164 | typeCheckingMode = "standard" 165 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |
2 |

3 |

FastAPI-key-auth

4 | 5 |

6 | Secure your FastAPI endpoints using API keys. 7 |
8 | Report Bug 9 | · 10 | Request Feature 11 |

12 |

13 | 14 | 15 |
16 |

Table of Contents

17 |
    18 |
  1. 19 | About The Project 20 | 23 |
  2. 24 |
  3. 25 | Getting Started 26 | 29 |
  4. 30 |
  5. Usage
  6. 31 |
  7. License
  8. 32 |
  9. Contact
  10. 33 |
34 |
35 | 36 | 37 | 38 | ## About The Project 39 | 40 | On deployment inject API keys authorized to use your service. Every call to a private 41 | endpoint of your service has to include a `header['x-api-key']` attribute that is 42 | validated against the API keys in your environment. 43 | If it is present, a request is authorized. If it is not FastAPI return `401 Unauthorized`. 44 | Use this either as a middleware, or as Dependency. 45 | 46 | ### Built With 47 | 48 | - [starlette](https://github.com/encode/starlette) 49 | - [fastapi](https://github.com/tiangolo/fastapi) 50 | 51 | 52 | 53 | ## Getting Started 54 | 55 | ### Installation 56 | 57 | 1. Clone and install 58 | ```sh 59 | git clone https://github.com/iwpnd/fastapi-key-auth.git 60 | uv sync 61 | ``` 62 | 2. Install with pip 63 | ```sh 64 | pip install fastapi-key-auth 65 | ``` 66 | 3. Install with uv 67 | ```sh 68 | uv add fastapi-key-auth 69 | ``` 70 | 71 | ## Usage 72 | 73 | As Middleware: 74 | 75 | ```python 76 | from fastapi import FastAPI 77 | from fastapi_key_auth import AuthorizerMiddleware 78 | 79 | app = FastAPI() 80 | 81 | app.add_middleware(AuthorizerMiddleware, public_paths=["/ping"], key_pattern="API_KEY_") 82 | 83 | # optional use regex startswith 84 | app.add_middleware(AuthorizerMiddleware, public_paths=["/ping", "^/users"]) 85 | ``` 86 | 87 | As Dependency 88 | 89 | ```python 90 | from fastapi import FastAPI, Depends 91 | from fastapi_key_auth import AuthorizerDependency 92 | 93 | authorizer = AuthorizerDependency(key_pattern="API_KEY_") 94 | 95 | # either globally or in a router 96 | app = FastAPI(dependencies=[Depends(authorizer)]) 97 | ``` 98 | 99 | ## License 100 | 101 | Distributed under the MIT License. See `LICENSE` for more information. 102 | 103 | 104 | 105 | ## Contact 106 | 107 | Benjamin Ramser - [@imwithpanda](https://twitter.com/imwithpanda) - ahoi@iwpnd.pw 108 | Project Link: [https://github.com/iwpnd/fastapi-key-auth](https://github.com/iwpnd/fastapi-key-auth) 109 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.15.5" 2 | 3 | import os 4 | import typing 5 | 6 | from .dependency import AuthorizerDependency 7 | from .middleware import AuthorizerMiddleware 8 | from .utils import get_default_api_key_pattern 9 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/dependency/__init__.py: -------------------------------------------------------------------------------- 1 | from .authorizer import AuthorizerDependency 2 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/dependency/authorizer.py: -------------------------------------------------------------------------------- 1 | from fastapi import Header, HTTPException 2 | 3 | from ..utils import get_api_keys_in_env, get_default_api_key_pattern 4 | 5 | 6 | class AuthorizerDependency: 7 | def __init__(self, key_pattern: str = get_default_api_key_pattern()) -> None: 8 | self.key_pattern = key_pattern 9 | 10 | def __call__(self, x_api_key: str | None = Header(...)) -> str | None: 11 | if x_api_key not in get_api_keys_in_env(self.key_pattern): 12 | raise HTTPException(status_code=401, detail="unauthorized") 13 | 14 | return x_api_key 15 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/middleware/__init__.py: -------------------------------------------------------------------------------- 1 | from .authorizer import AuthorizerMiddleware 2 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/middleware/authorizer.py: -------------------------------------------------------------------------------- 1 | import re 2 | import typing 3 | 4 | from starlette.authentication import AuthenticationError 5 | from starlette.requests import HTTPConnection 6 | from starlette.responses import JSONResponse, Response 7 | from starlette.types import ASGIApp, Receive, Scope, Send 8 | 9 | from ..utils import get_api_keys_in_env, get_default_api_key_pattern 10 | 11 | 12 | class Authenticator: 13 | key_pattern: str 14 | 15 | def authenticate(self, conn: HTTPConnection) -> bool: 16 | if "x-api-key" not in conn.headers: 17 | raise AuthenticationError("no api key") 18 | 19 | api_key = conn.headers["x-api-key"] 20 | for key in get_api_keys_in_env(self.key_pattern): 21 | if api_key == key: 22 | return True 23 | 24 | raise AuthenticationError("invalid api key") 25 | 26 | 27 | class AuthorizerMiddleware(Authenticator): 28 | def __init__( 29 | self, 30 | app: ASGIApp, 31 | key_pattern: str = get_default_api_key_pattern(), 32 | public_paths: list[str] = [], 33 | on_error: typing.Callable[[HTTPConnection, AuthenticationError], Response] 34 | | None = None, 35 | ) -> None: 36 | self.app = app 37 | self.on_error: typing.Callable[ 38 | [HTTPConnection, AuthenticationError], Response 39 | ] = on_error if on_error is not None else self.default_on_error 40 | self.key_pattern = key_pattern 41 | self.public_paths: list[str] = [ 42 | path for path in public_paths if path.startswith("/") 43 | ] 44 | self.public_paths_regex: list[str] = [ 45 | path for path in public_paths if path.startswith("^") 46 | ] 47 | 48 | async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: 49 | if scope.get("type") not in ["http", "websocket"]: 50 | await self.app(scope, receive, send) 51 | return 52 | 53 | if len(self.public_paths) > 0: 54 | for path in self.public_paths: 55 | if re.match(path, scope["path"]): 56 | await self.app(scope, receive, send) 57 | return 58 | 59 | if len(self.public_paths_regex) > 0: 60 | for path in self.public_paths_regex: 61 | if re.match(path, scope["path"]): 62 | await self.app(scope, receive, send) 63 | return 64 | 65 | conn = HTTPConnection(scope) 66 | 67 | try: 68 | auth_result = self.authenticate(conn) 69 | except AuthenticationError as e: 70 | response = self.on_error(conn, e) 71 | await response(scope, receive, send) 72 | return 73 | 74 | if auth_result: 75 | await self.app(scope, receive, send) 76 | 77 | @staticmethod 78 | def default_on_error(conn: HTTPConnection, e: Exception) -> Response: 79 | return JSONResponse({"detail": str(e)}, status_code=401) 80 | -------------------------------------------------------------------------------- /src/fastapi_key_auth/utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | def get_default_api_key_pattern() -> str: 5 | return "API_KEY_" 6 | 7 | 8 | def get_api_keys_in_env(key_pattern: str) -> list[str | None]: 9 | return [os.getenv(key) for key in os.environ if key.startswith(key_pattern)] 10 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | from fastapi_key_auth.dependency import AuthorizerDependency 2 | from fastapi_key_auth.middleware import AuthorizerMiddleware 3 | from fastapi_key_auth.utils import get_api_keys_in_env, get_default_api_key_pattern 4 | 5 | __all__ = ["AuthorizerDependency", "AuthorizerMiddleware"] 6 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | @pytest.fixture(autouse=True) 5 | def env_setup(monkeypatch) -> None: # type: ignore[no-untyped-def] 6 | monkeypatch.setenv("API_KEY_DEV", "test") 7 | -------------------------------------------------------------------------------- /tests/test_dependency_authorizer.py: -------------------------------------------------------------------------------- 1 | from fastapi import Depends, FastAPI 2 | from fastapi.testclient import TestClient 3 | 4 | from fastapi_key_auth import AuthorizerDependency 5 | 6 | authorizer = AuthorizerDependency(key_pattern="API_KEY_") 7 | 8 | app = FastAPI(dependencies=[Depends(authorizer)]) 9 | 10 | 11 | @app.get("/ping") 12 | async def ping() -> dict[str, str]: 13 | return {"ping": "pong!"} 14 | 15 | 16 | client = TestClient(app) 17 | 18 | 19 | def test_unauthorized_no_api_key() -> None: 20 | response = client.get("/ping") 21 | assert response.status_code == 422 22 | 23 | 24 | def test_unauthorized_invalid_api_key() -> None: 25 | response = client.get("/ping", headers={"x-api-key": "baguette"}) 26 | assert response.status_code == 401 27 | assert response.json() == {"detail": "unauthorized"} 28 | 29 | 30 | def test_authorized() -> None: 31 | response = client.get("/ping", headers={"x-api-key": "test"}) 32 | 33 | assert response.status_code == 200 34 | assert response.json() == {"ping": "pong!"} 35 | -------------------------------------------------------------------------------- /tests/test_dependency_custom_pattern.py: -------------------------------------------------------------------------------- 1 | from fastapi import Depends, FastAPI 2 | from fastapi.testclient import TestClient 3 | 4 | from fastapi_key_auth import AuthorizerDependency 5 | 6 | authorizer = AuthorizerDependency(key_pattern="KEY_") 7 | app = FastAPI(dependencies=[Depends(authorizer)]) 8 | 9 | 10 | @app.get("/ping") 11 | async def ping() -> dict[str, str]: 12 | return {"ping": "pong!"} 13 | 14 | 15 | client = TestClient(app) 16 | 17 | 18 | def test_unauthorized_no_api_key_custom_pattern() -> None: 19 | response = client.get("/ping") 20 | assert response.status_code == 422 21 | 22 | 23 | def test_unauthorized_invalid_api_key_custom_pattern(monkeypatch) -> None: # type: ignore[no-untyped-def] 24 | monkeypatch.setenv("KEY_TEST", "test") 25 | response = client.get("/ping", headers={"x-api-key": "baguette"}) 26 | assert response.status_code == 401 27 | assert response.json() == {"detail": "unauthorized"} 28 | 29 | 30 | def test_authorized_custom_pattern(monkeypatch) -> None: # type: ignore[no-untyped-def] 31 | monkeypatch.setenv("KEY_TEST", "test") 32 | response = client.get("/ping", headers={"x-api-key": "test"}) 33 | assert response.status_code == 200 34 | assert response.json() == {"ping": "pong!"} 35 | -------------------------------------------------------------------------------- /tests/test_middleware_authorizer.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter, FastAPI 2 | from fastapi.testclient import TestClient 3 | 4 | from fastapi_key_auth import AuthorizerMiddleware 5 | 6 | app = FastAPI() 7 | router = APIRouter() 8 | 9 | app.add_middleware( 10 | AuthorizerMiddleware, public_paths=["/health", "/docs", "/router", "^/regex"] 11 | ) 12 | 13 | 14 | @router.get("/router") 15 | async def get_router() -> dict[str, bool]: 16 | return {"ok": True} 17 | 18 | 19 | app.include_router(router) 20 | 21 | 22 | @app.get("/ping") 23 | async def ping() -> dict[str, str]: 24 | return {"ping": "pong!"} 25 | 26 | 27 | @app.get("/regex/test") 28 | async def regex() -> dict[str, bool]: 29 | return {"regex": True} 30 | 31 | 32 | @app.get("/health") 33 | async def health() -> dict[str, bool]: 34 | return {"ok": True} 35 | 36 | 37 | client = TestClient(app) 38 | 39 | 40 | def test_unauthorized_no_api_key() -> None: 41 | response = client.get("/ping") 42 | assert response.status_code == 401 43 | assert response.json() == {"detail": "no api key"} 44 | 45 | 46 | def test_unauthorized_invalid_api_key() -> None: 47 | response = client.get("/ping", headers={"x-api-key": "baguette"}) 48 | assert response.status_code == 401 49 | assert response.json() == {"detail": "invalid api key"} 50 | 51 | 52 | def test_unauthorized_empty_api_key() -> None: 53 | response = client.get("/ping", headers={"x-api-key": ""}) 54 | assert response.status_code == 401 55 | assert response.json() == {"detail": "invalid api key"} 56 | 57 | 58 | def test_authorized() -> None: 59 | response = client.get("/ping", headers={"x-api-key": "test"}) 60 | 61 | assert response.status_code == 200 62 | assert response.json() == {"ping": "pong!"} 63 | 64 | 65 | def test_public_path() -> None: 66 | response = client.get("/health") 67 | 68 | assert response.status_code == 200 69 | assert response.json() == {"ok": True} 70 | 71 | 72 | def test_docs_path() -> None: 73 | response = client.get("/docs") 74 | assert response.status_code == 200 75 | 76 | 77 | def test_router() -> None: 78 | response = client.get("/router") 79 | assert response.status_code == 200 80 | 81 | 82 | def test_regex() -> None: 83 | response = client.get("/regex/test") 84 | assert response.status_code == 200 85 | -------------------------------------------------------------------------------- /tests/test_middleware_custom_pattern.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from fastapi.testclient import TestClient 3 | 4 | from fastapi_key_auth import AuthorizerMiddleware 5 | 6 | app = FastAPI() 7 | 8 | app.add_middleware(AuthorizerMiddleware, key_pattern="KEY_") 9 | 10 | 11 | @app.get("/ping") 12 | async def ping() -> dict[str, str]: 13 | return {"ping": "pong!"} 14 | 15 | 16 | client = TestClient(app) 17 | 18 | 19 | def test_unauthorized_no_api_key_custom_pattern() -> None: 20 | response = client.get("/ping") 21 | assert response.status_code == 401 22 | assert response.json() == {"detail": "no api key"} 23 | 24 | 25 | def test_unauthorized_invalid_api_key_custom_pattern(monkeypatch) -> None: # type: ignore[no-untyped-def] 26 | monkeypatch.setenv("KEY_TEST", "test") 27 | response = client.get("/ping", headers={"x-api-key": "baguette"}) 28 | assert response.status_code == 401 29 | assert response.json() == {"detail": "invalid api key"} 30 | 31 | 32 | def test_authorized_custom_pattern(monkeypatch) -> None: # type: ignore[no-untyped-def] 33 | monkeypatch.setenv("KEY_TEST", "test") 34 | response = client.get("/ping", headers={"x-api-key": "test"}) 35 | assert response.status_code == 200 36 | assert response.json() == {"ping": "pong!"} 37 | --------------------------------------------------------------------------------