litestar-security 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- litestar_security-0.1.0/.github/dependabot.yml +13 -0
- litestar_security-0.1.0/.github/workflows/ci.yml +154 -0
- litestar_security-0.1.0/.github/workflows/docs.yml +51 -0
- litestar_security-0.1.0/.github/workflows/pr-title.yml +17 -0
- litestar_security-0.1.0/.github/workflows/publish.yml +39 -0
- litestar_security-0.1.0/.github/workflows/test.yml +93 -0
- litestar_security-0.1.0/.gitignore +78 -0
- litestar_security-0.1.0/.pre-commit-config.yaml +55 -0
- litestar_security-0.1.0/CONTRIBUTING.rst +59 -0
- litestar_security-0.1.0/LICENSE +21 -0
- litestar_security-0.1.0/Makefile +248 -0
- litestar_security-0.1.0/PKG-INFO +109 -0
- litestar_security-0.1.0/README.md +74 -0
- litestar_security-0.1.0/docs/_static/custom.css +14 -0
- litestar_security-0.1.0/docs/_static/security-shield.svg +5 -0
- litestar_security-0.1.0/docs/_static/security-star.svg +5 -0
- litestar_security-0.1.0/docs/accounts.rst +23 -0
- litestar_security-0.1.0/docs/authentication.rst +71 -0
- litestar_security-0.1.0/docs/changelog.rst +25 -0
- litestar_security-0.1.0/docs/conf.py +79 -0
- litestar_security-0.1.0/docs/contributing.rst +40 -0
- litestar_security-0.1.0/docs/customization.rst +26 -0
- litestar_security-0.1.0/docs/examples.rst +21 -0
- litestar_security-0.1.0/docs/generated-routes.rst +181 -0
- litestar_security-0.1.0/docs/getting-started.rst +97 -0
- litestar_security-0.1.0/docs/hardening.rst +21 -0
- litestar_security-0.1.0/docs/index.rst +67 -0
- litestar_security-0.1.0/docs/introduction.rst +21 -0
- litestar_security-0.1.0/docs/jwt-and-jwks.rst +322 -0
- litestar_security-0.1.0/docs/providers.rst +45 -0
- litestar_security-0.1.0/docs/rate-limiting.rst +191 -0
- litestar_security-0.1.0/docs/reference.rst +82 -0
- litestar_security-0.1.0/docs/websockets.rst +23 -0
- litestar_security-0.1.0/examples/README.md +52 -0
- litestar_security-0.1.0/examples/__init__.py +1 -0
- litestar_security-0.1.0/examples/app.py +142 -0
- litestar_security-0.1.0/examples/support.py +581 -0
- litestar_security-0.1.0/pyproject.toml +271 -0
- litestar_security-0.1.0/src/litestar_security/__init__.py +194 -0
- litestar_security-0.1.0/src/litestar_security/__metadata__.py +12 -0
- litestar_security-0.1.0/src/litestar_security/_cli.py +28 -0
- litestar_security-0.1.0/src/litestar_security/_openapi.py +557 -0
- litestar_security-0.1.0/src/litestar_security/accounts/__init__.py +353 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_access_tokens.py +315 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_controllers.py +739 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_internal.py +108 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_login.py +316 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_mfa.py +1045 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_mfa_controllers.py +669 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_mfa_schemas.py +166 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_operations.py +120 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_passkeys.py +1047 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_passwords.py +469 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_profiles.py +936 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_purpose_tokens.py +410 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_rate_limits.py +493 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_receipts.py +306 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_records.py +423 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_recovery.py +633 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_refresh.py +820 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_refresh_tokens.py +325 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_registration.py +321 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_schemas.py +131 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_sessions.py +1196 -0
- litestar_security-0.1.0/src/litestar_security/accounts/_stores.py +396 -0
- litestar_security-0.1.0/src/litestar_security/authentication.py +1134 -0
- litestar_security-0.1.0/src/litestar_security/config.py +368 -0
- litestar_security-0.1.0/src/litestar_security/context.py +472 -0
- litestar_security-0.1.0/src/litestar_security/guards.py +496 -0
- litestar_security-0.1.0/src/litestar_security/headers.py +276 -0
- litestar_security-0.1.0/src/litestar_security/plugin.py +676 -0
- litestar_security-0.1.0/src/litestar_security/providers/__init__.py +142 -0
- litestar_security-0.1.0/src/litestar_security/providers/_internal.py +59 -0
- litestar_security-0.1.0/src/litestar_security/providers/api_key/__init__.py +27 -0
- litestar_security-0.1.0/src/litestar_security/providers/api_key/_api_key.py +601 -0
- litestar_security-0.1.0/src/litestar_security/providers/api_key/_runtime.py +315 -0
- litestar_security-0.1.0/src/litestar_security/providers/iap/__init__.py +5 -0
- litestar_security-0.1.0/src/litestar_security/providers/iap/_iap.py +223 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/__init__.py +27 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/_cache.py +127 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/_documents.py +97 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/_fetching.py +187 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/_internal.py +69 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwks/_provider.py +457 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/__init__.py +49 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_bearer.py +297 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_claims.py +418 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_internal.py +146 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_keyring.py +380 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_keys.py +294 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_signing.py +100 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_verification.py +294 -0
- litestar_security-0.1.0/src/litestar_security/providers/jwt/_workers.py +66 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/__init__.py +151 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/_accounts.py +709 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/_local.py +105 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/_provider.py +988 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/_routes.py +848 -0
- litestar_security-0.1.0/src/litestar_security/providers/oauth/_transactions.py +740 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/__init__.py +28 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_discovery.py +345 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_internal.py +36 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_keycloak.py +126 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_logout.py +65 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_provider.py +398 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_service.py +192 -0
- litestar_security-0.1.0/src/litestar_security/providers/oidc/_urls.py +85 -0
- litestar_security-0.1.0/src/litestar_security/py.typed +0 -0
- litestar_security-0.1.0/src/litestar_security/testing.py +953 -0
- litestar_security-0.1.0/src/litestar_security/websocket.py +841 -0
- litestar_security-0.1.0/src/tests/__init__.py +0 -0
- litestar_security-0.1.0/src/tests/conftest.py +43 -0
- litestar_security-0.1.0/src/tests/examples/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/examples/test_local_modes.py +138 -0
- litestar_security-0.1.0/src/tests/examples/test_provider_modes.py +63 -0
- litestar_security-0.1.0/src/tests/examples/test_websocket_admin_modes.py +82 -0
- litestar_security-0.1.0/src/tests/fixtures/downstream_consumer/pyproject.toml +24 -0
- litestar_security-0.1.0/src/tests/fixtures/downstream_consumer/src/consumer_backend/__init__.py +60 -0
- litestar_security-0.1.0/src/tests/fixtures/downstream_consumer/src/consumer_backend/py.typed +0 -0
- litestar_security-0.1.0/src/tests/fixtures/downstream_consumer/tests/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/fixtures/downstream_consumer/tests/test_backend.py +16 -0
- litestar_security-0.1.0/src/tests/fixtures/keycloak/realm.json +18 -0
- litestar_security-0.1.0/src/tests/integration/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/integration/conftest.py +11 -0
- litestar_security-0.1.0/src/tests/integration/test_oauth_routes.py +1008 -0
- litestar_security-0.1.0/src/tests/integration/test_plugin.py +3234 -0
- litestar_security-0.1.0/src/tests/integration/test_runtime.py +1994 -0
- litestar_security-0.1.0/src/tests/property/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/property/test_security_properties.py +103 -0
- litestar_security-0.1.0/src/tests/typing/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/typing/helpers.py +92 -0
- litestar_security-0.1.0/src/tests/unit/__init__.py +1 -0
- litestar_security-0.1.0/src/tests/unit/conftest.py +31 -0
- litestar_security-0.1.0/src/tests/unit/test_api_key.py +772 -0
- litestar_security-0.1.0/src/tests/unit/test_authentication_evaluator.py +756 -0
- litestar_security-0.1.0/src/tests/unit/test_authentication_registry.py +11536 -0
- litestar_security-0.1.0/src/tests/unit/test_conformance_kit.py +159 -0
- litestar_security-0.1.0/src/tests/unit/test_context.py +2776 -0
- litestar_security-0.1.0/src/tests/unit/test_extensibility.py +212 -0
- litestar_security-0.1.0/src/tests/unit/test_github_oauth.py +329 -0
- litestar_security-0.1.0/src/tests/unit/test_headers.py +101 -0
- litestar_security-0.1.0/src/tests/unit/test_iap.py +279 -0
- litestar_security-0.1.0/src/tests/unit/test_in_memory_backend.py +202 -0
- litestar_security-0.1.0/src/tests/unit/test_oauth_accounts.py +649 -0
- litestar_security-0.1.0/src/tests/unit/test_oauth_provider.py +702 -0
- litestar_security-0.1.0/src/tests/unit/test_oauth_transactions.py +722 -0
- litestar_security-0.1.0/src/tests/unit/test_oidc_login.py +630 -0
- litestar_security-0.1.0/src/tests/unit/test_service_oidc.py +358 -0
- litestar_security-0.1.0/src/tests/unit/test_websocket.py +967 -0
- litestar_security-0.1.0/tools/__init__.py +0 -0
- litestar_security-0.1.0/tools/check_downstream_consumer.py +47 -0
- litestar_security-0.1.0/tools/check_release.py +196 -0
- litestar_security-0.1.0/tools/hooks/__init__.py +1 -0
- litestar_security-0.1.0/tools/hooks/no_future_annotations.py +43 -0
- litestar_security-0.1.0/tools/scripts/setup-env.sh +41 -0
- litestar_security-0.1.0/uv.lock +2438 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ci-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
prek:
|
|
17
|
+
name: Ruff and prek
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
24
|
+
with:
|
|
25
|
+
enable-cache: true
|
|
26
|
+
- run: uv python install 3.14
|
|
27
|
+
- run: uv sync --all-groups --python 3.14
|
|
28
|
+
- run: make lint
|
|
29
|
+
|
|
30
|
+
mypy:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
34
|
+
with:
|
|
35
|
+
persist-credentials: false
|
|
36
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
37
|
+
with:
|
|
38
|
+
enable-cache: true
|
|
39
|
+
- run: uv python install 3.14
|
|
40
|
+
- run: uv sync --all-groups --python 3.14
|
|
41
|
+
- run: make mypy
|
|
42
|
+
|
|
43
|
+
pyright:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
47
|
+
with:
|
|
48
|
+
persist-credentials: false
|
|
49
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
50
|
+
with:
|
|
51
|
+
enable-cache: true
|
|
52
|
+
- run: uv python install 3.14
|
|
53
|
+
- run: uv sync --all-groups --python 3.14
|
|
54
|
+
- run: make pyright
|
|
55
|
+
|
|
56
|
+
slotscheck:
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
60
|
+
with:
|
|
61
|
+
persist-credentials: false
|
|
62
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
63
|
+
with:
|
|
64
|
+
enable-cache: true
|
|
65
|
+
- run: uv python install 3.14
|
|
66
|
+
- run: uv sync --all-groups --python 3.14
|
|
67
|
+
- run: make slotscheck
|
|
68
|
+
|
|
69
|
+
property:
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
73
|
+
with:
|
|
74
|
+
persist-credentials: false
|
|
75
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
76
|
+
with:
|
|
77
|
+
enable-cache: true
|
|
78
|
+
- run: uv python install 3.14
|
|
79
|
+
- run: uv sync --group tests --python 3.14
|
|
80
|
+
- run: make property
|
|
81
|
+
|
|
82
|
+
test_python:
|
|
83
|
+
name: test (python ${{ matrix.python-version }})
|
|
84
|
+
strategy:
|
|
85
|
+
fail-fast: false
|
|
86
|
+
matrix:
|
|
87
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
88
|
+
uses: ./.github/workflows/test.yml
|
|
89
|
+
with:
|
|
90
|
+
coverage: ${{ matrix.python-version == '3.14' }}
|
|
91
|
+
python-version: ${{ matrix.python-version }}
|
|
92
|
+
timeout: 60
|
|
93
|
+
|
|
94
|
+
codecov:
|
|
95
|
+
needs: test_python
|
|
96
|
+
runs-on: ubuntu-latest
|
|
97
|
+
steps:
|
|
98
|
+
- name: Download coverage artifact
|
|
99
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
100
|
+
with:
|
|
101
|
+
name: coverage-xml
|
|
102
|
+
path: .
|
|
103
|
+
|
|
104
|
+
- name: Upload coverage reports to Codecov
|
|
105
|
+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
|
|
106
|
+
with:
|
|
107
|
+
files: coverage.xml
|
|
108
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
109
|
+
slug: cofin/litestar-security
|
|
110
|
+
|
|
111
|
+
docs:
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
steps:
|
|
114
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
115
|
+
with:
|
|
116
|
+
persist-credentials: false
|
|
117
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
118
|
+
with:
|
|
119
|
+
enable-cache: true
|
|
120
|
+
- run: uv python install 3.14
|
|
121
|
+
- run: uv sync --group docs --python 3.14
|
|
122
|
+
- run: make docs
|
|
123
|
+
- run: make docs-linkcheck
|
|
124
|
+
|
|
125
|
+
build:
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
steps:
|
|
128
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
129
|
+
with:
|
|
130
|
+
persist-credentials: false
|
|
131
|
+
- uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
132
|
+
with:
|
|
133
|
+
enable-cache: true
|
|
134
|
+
- run: uv python install 3.14
|
|
135
|
+
- run: uv sync --group build --python 3.14
|
|
136
|
+
- run: make build
|
|
137
|
+
- name: Install and smoke-test wheel
|
|
138
|
+
run: |
|
|
139
|
+
uv venv --python 3.14 /tmp/litestar-security-smoke
|
|
140
|
+
uv pip install --python /tmp/litestar-security-smoke/bin/python dist/*.whl
|
|
141
|
+
/tmp/litestar-security-smoke/bin/python - <<'PY'
|
|
142
|
+
from importlib.resources import files
|
|
143
|
+
|
|
144
|
+
import litestar_security
|
|
145
|
+
from litestar_security import SecurityConfig, SecurityPlugin
|
|
146
|
+
|
|
147
|
+
assert litestar_security.__project__ == "litestar-security"
|
|
148
|
+
assert litestar_security.__version__ == "0.1.0"
|
|
149
|
+
assert SecurityConfig is not None
|
|
150
|
+
assert SecurityPlugin is not None
|
|
151
|
+
assert files("litestar_security").joinpath("py.typed").is_file()
|
|
152
|
+
PY
|
|
153
|
+
/tmp/litestar-security-smoke/bin/litestar security --help
|
|
154
|
+
/tmp/litestar-security-smoke/bin/litestar security --version
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Documentation Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out repository
|
|
16
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
22
|
+
with:
|
|
23
|
+
enable-cache: true
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
run: uv python install 3.14
|
|
27
|
+
|
|
28
|
+
- name: Install documentation dependencies
|
|
29
|
+
run: uv sync --group docs --python 3.14
|
|
30
|
+
|
|
31
|
+
- name: Build documentation
|
|
32
|
+
run: make docs
|
|
33
|
+
|
|
34
|
+
- name: Upload Pages artifact
|
|
35
|
+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
|
|
36
|
+
with:
|
|
37
|
+
path: docs/_build/html
|
|
38
|
+
|
|
39
|
+
deploy:
|
|
40
|
+
needs: build
|
|
41
|
+
permissions:
|
|
42
|
+
pages: write
|
|
43
|
+
id-token: write
|
|
44
|
+
environment:
|
|
45
|
+
name: github-pages
|
|
46
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- name: Deploy to GitHub Pages
|
|
50
|
+
id: deployment
|
|
51
|
+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Validate PR title
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, edited, synchronize, reopened]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
title:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
|
16
|
+
env:
|
|
17
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: pypi
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
pypi:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write
|
|
17
|
+
environment: pypi
|
|
18
|
+
steps:
|
|
19
|
+
- name: Check out repository
|
|
20
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
26
|
+
with:
|
|
27
|
+
enable-cache: false
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
run: uv python install 3.14
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: make install PYTHON_VERSION=3.14 UV_SYNC_ARGS=--all-extras
|
|
34
|
+
|
|
35
|
+
- name: Build package
|
|
36
|
+
run: uv build
|
|
37
|
+
|
|
38
|
+
- name: Publish package distributions to PyPI
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
python-version:
|
|
7
|
+
required: true
|
|
8
|
+
type: string
|
|
9
|
+
coverage:
|
|
10
|
+
required: false
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
13
|
+
os:
|
|
14
|
+
required: false
|
|
15
|
+
type: string
|
|
16
|
+
default: ubuntu-latest
|
|
17
|
+
timeout:
|
|
18
|
+
required: false
|
|
19
|
+
type: number
|
|
20
|
+
default: 60
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
test:
|
|
27
|
+
runs-on: ${{ inputs.os }}
|
|
28
|
+
timeout-minutes: ${{ inputs.timeout }}
|
|
29
|
+
env:
|
|
30
|
+
PYTHON_VERSION: ${{ inputs.python-version }}
|
|
31
|
+
defaults:
|
|
32
|
+
run:
|
|
33
|
+
shell: bash
|
|
34
|
+
steps:
|
|
35
|
+
- name: Check out repository
|
|
36
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
|
|
40
|
+
- name: Install uv
|
|
41
|
+
uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.2
|
|
42
|
+
with:
|
|
43
|
+
enable-cache: true
|
|
44
|
+
|
|
45
|
+
- name: Set up Python
|
|
46
|
+
run: uv python install "$PYTHON_VERSION"
|
|
47
|
+
|
|
48
|
+
- name: Install test dependencies
|
|
49
|
+
run: uv sync --group tests --python "$PYTHON_VERSION"
|
|
50
|
+
|
|
51
|
+
- name: Test
|
|
52
|
+
if: ${{ !inputs.coverage }}
|
|
53
|
+
run: make test
|
|
54
|
+
|
|
55
|
+
- name: Test with coverage
|
|
56
|
+
if: ${{ inputs.coverage }}
|
|
57
|
+
run: >-
|
|
58
|
+
uv run pytest -m "not performance"
|
|
59
|
+
--cov=litestar_security
|
|
60
|
+
--cov-branch
|
|
61
|
+
--cov-report=term-missing
|
|
62
|
+
--cov-report=xml
|
|
63
|
+
|
|
64
|
+
- name: Build and smoke-test installed wheel
|
|
65
|
+
run: |
|
|
66
|
+
uv build --wheel --out-dir /tmp/litestar-security-dist
|
|
67
|
+
uv venv --python "$PYTHON_VERSION" /tmp/litestar-security-wheel
|
|
68
|
+
uv pip install --python /tmp/litestar-security-wheel/bin/python /tmp/litestar-security-dist/*.whl
|
|
69
|
+
cd /tmp
|
|
70
|
+
/tmp/litestar-security-wheel/bin/python -I - <<'PY'
|
|
71
|
+
from importlib.resources import files
|
|
72
|
+
from pkgutil import walk_packages
|
|
73
|
+
import importlib
|
|
74
|
+
import sys
|
|
75
|
+
|
|
76
|
+
import litestar_security
|
|
77
|
+
|
|
78
|
+
for module in walk_packages(litestar_security.__path__, "litestar_security."):
|
|
79
|
+
if not any(part.startswith("_") for part in module.name.split(".")):
|
|
80
|
+
importlib.import_module(module.name)
|
|
81
|
+
|
|
82
|
+
assert litestar_security.__version__ == "0.1.0"
|
|
83
|
+
assert files("litestar_security").joinpath("py.typed").is_file()
|
|
84
|
+
assert "pytest" not in sys.modules
|
|
85
|
+
PY
|
|
86
|
+
/tmp/litestar-security-wheel/bin/litestar security --version
|
|
87
|
+
|
|
88
|
+
- name: Upload coverage artifact
|
|
89
|
+
if: ${{ inputs.coverage }}
|
|
90
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
91
|
+
with:
|
|
92
|
+
name: coverage-xml
|
|
93
|
+
path: coverage.xml
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Virtual environments and local Python installations
|
|
2
|
+
.venv/
|
|
3
|
+
venv/
|
|
4
|
+
env/
|
|
5
|
+
.python-version
|
|
6
|
+
|
|
7
|
+
# Secrets and local environment files
|
|
8
|
+
.env
|
|
9
|
+
.env.*
|
|
10
|
+
!.env.example
|
|
11
|
+
*.pem
|
|
12
|
+
*.key
|
|
13
|
+
|
|
14
|
+
# Python bytecode and tool caches
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[cod]
|
|
17
|
+
*$py.class
|
|
18
|
+
.cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
.pyright/
|
|
22
|
+
.ruff_cache/
|
|
23
|
+
.tox/
|
|
24
|
+
.nox/
|
|
25
|
+
.hypothesis/
|
|
26
|
+
|
|
27
|
+
# Test and coverage output
|
|
28
|
+
.coverage
|
|
29
|
+
.coverage.*
|
|
30
|
+
coverage.json
|
|
31
|
+
coverage.xml
|
|
32
|
+
htmlcov/
|
|
33
|
+
junit.xml
|
|
34
|
+
|
|
35
|
+
# Build and packaging output
|
|
36
|
+
build/
|
|
37
|
+
dist/
|
|
38
|
+
*.egg
|
|
39
|
+
*.egg-info/
|
|
40
|
+
.eggs/
|
|
41
|
+
|
|
42
|
+
# Documentation output
|
|
43
|
+
docs/_build/
|
|
44
|
+
docs-build/
|
|
45
|
+
|
|
46
|
+
# Editors and operating systems
|
|
47
|
+
.idea/
|
|
48
|
+
.vscode/
|
|
49
|
+
*.code-workspace
|
|
50
|
+
*.swp
|
|
51
|
+
*.swo
|
|
52
|
+
*~
|
|
53
|
+
.DS_Store
|
|
54
|
+
Thumbs.db
|
|
55
|
+
|
|
56
|
+
# Local Flow, Beads, Dolt, and agent harness state
|
|
57
|
+
AGENTS.md
|
|
58
|
+
.agents/
|
|
59
|
+
.beads/
|
|
60
|
+
.dolt/
|
|
61
|
+
.codex/
|
|
62
|
+
.claude/
|
|
63
|
+
.gemini/
|
|
64
|
+
.opencode/
|
|
65
|
+
opencode.json
|
|
66
|
+
|
|
67
|
+
# Local scratch and logs
|
|
68
|
+
.tmp/
|
|
69
|
+
tmp/
|
|
70
|
+
*.log
|
|
71
|
+
benchmarks/
|
|
72
|
+
|
|
73
|
+
# Keep the reproducible uv lockfile tracked
|
|
74
|
+
!uv.lock
|
|
75
|
+
|
|
76
|
+
# Beads / Dolt files (added by bd init)
|
|
77
|
+
*.db
|
|
78
|
+
.beads-credential-key
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: "3"
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: local
|
|
6
|
+
hooks:
|
|
7
|
+
- id: no-future-annotations
|
|
8
|
+
name: Disallow future annotations in package code
|
|
9
|
+
entry: python tools/hooks/no_future_annotations.py
|
|
10
|
+
language: python
|
|
11
|
+
files: ^src/litestar_security/.*\.py$
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
14
|
+
rev: v4.4.0
|
|
15
|
+
hooks:
|
|
16
|
+
- id: conventional-pre-commit
|
|
17
|
+
stages: [commit-msg]
|
|
18
|
+
|
|
19
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
20
|
+
rev: v6.0.0
|
|
21
|
+
hooks:
|
|
22
|
+
- id: check-ast
|
|
23
|
+
- id: check-case-conflict
|
|
24
|
+
- id: check-toml
|
|
25
|
+
- id: check-yaml
|
|
26
|
+
- id: debug-statements
|
|
27
|
+
- id: end-of-file-fixer
|
|
28
|
+
- id: mixed-line-ending
|
|
29
|
+
- id: trailing-whitespace
|
|
30
|
+
|
|
31
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
32
|
+
rev: v0.15.22
|
|
33
|
+
hooks:
|
|
34
|
+
- id: ruff-check
|
|
35
|
+
args: [--fix]
|
|
36
|
+
- id: ruff-format
|
|
37
|
+
|
|
38
|
+
- repo: https://github.com/python-formate/flake8-dunder-all
|
|
39
|
+
rev: v0.6.0
|
|
40
|
+
hooks:
|
|
41
|
+
- id: ensure-dunder-all
|
|
42
|
+
args: [--use-tuple]
|
|
43
|
+
exclude: ^(docs|src/tests|tools)/
|
|
44
|
+
|
|
45
|
+
- repo: https://github.com/ariebovenberg/slotscheck
|
|
46
|
+
rev: v0.20.1
|
|
47
|
+
hooks:
|
|
48
|
+
- id: slotscheck
|
|
49
|
+
files: ^src/litestar_security/
|
|
50
|
+
|
|
51
|
+
- repo: https://github.com/codespell-project/codespell
|
|
52
|
+
rev: v2.4.3
|
|
53
|
+
hooks:
|
|
54
|
+
- id: codespell
|
|
55
|
+
additional_dependencies: [tomli]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Contributing
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Litestar Security is pre-alpha. Contributions should preserve the small public
|
|
5
|
+
surface until authentication or authorization behavior has an approved design.
|
|
6
|
+
|
|
7
|
+
Development installation
|
|
8
|
+
------------------------
|
|
9
|
+
|
|
10
|
+
The project uses ``uv`` for dependency management. From the repository root,
|
|
11
|
+
install every locked development group:
|
|
12
|
+
|
|
13
|
+
.. code-block:: console
|
|
14
|
+
|
|
15
|
+
make install
|
|
16
|
+
|
|
17
|
+
The supported Python range is 3.10 through 3.14. The lockfile remains tracked
|
|
18
|
+
so local development and CI resolve the same dependency graph.
|
|
19
|
+
|
|
20
|
+
Making a change
|
|
21
|
+
---------------
|
|
22
|
+
|
|
23
|
+
Write a failing test before changing behavior, then implement the smallest
|
|
24
|
+
change that makes it pass. Keep plugin lifecycle concerns separate from future
|
|
25
|
+
authentication and authorization features.
|
|
26
|
+
|
|
27
|
+
Run the focused checks while editing:
|
|
28
|
+
|
|
29
|
+
.. code-block:: console
|
|
30
|
+
|
|
31
|
+
make test
|
|
32
|
+
make type-check
|
|
33
|
+
make lint
|
|
34
|
+
|
|
35
|
+
Before proposing a change, run the complete validation surface:
|
|
36
|
+
|
|
37
|
+
.. code-block:: console
|
|
38
|
+
|
|
39
|
+
make check-all
|
|
40
|
+
|
|
41
|
+
Documentation
|
|
42
|
+
-------------
|
|
43
|
+
|
|
44
|
+
Build the documentation and validate links locally:
|
|
45
|
+
|
|
46
|
+
.. code-block:: console
|
|
47
|
+
|
|
48
|
+
make docs
|
|
49
|
+
make docs-linkcheck
|
|
50
|
+
|
|
51
|
+
Public changes should include an entry under ``Unreleased`` in
|
|
52
|
+
``docs/changelog.rst``.
|
|
53
|
+
|
|
54
|
+
Commit messages
|
|
55
|
+
---------------
|
|
56
|
+
|
|
57
|
+
Use Conventional Commits, such as ``feat: add a security integration`` or
|
|
58
|
+
``docs: clarify plugin setup``. The repository hooks validate commit messages
|
|
59
|
+
and source files.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cody Fincher
|
|
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
|
+
FITNESS 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.
|