fix: reorder imports and use ty-compatible type suppression

This commit is contained in:
Johan Lundberg 2026-02-19 14:29:01 +01:00
parent f648422227
commit 1054feb534
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1
12 changed files with 14 additions and 14 deletions

View file

@ -110,16 +110,16 @@ def create_app(settings: Settings | None = None) -> FastAPI:
# Session middleware
session_secret = settings.session_secret or secrets.token_hex(32)
app.add_middleware(
CSRFMiddleware,
CSRFMiddleware, # ty: ignore[invalid-argument-type]
exempt_paths={"/token", "/userinfo"},
check_origin=settings.issuer,
)
app.add_middleware(
SessionMiddleware,
SessionMiddleware, # ty: ignore[invalid-argument-type]
secret_key=session_secret,
same_site="lax",
https_only=settings.session_https_only,
) # type: ignore[arg-type]
)
# Templates
templates = Jinja2Templates(directory=str(PACKAGE_DIR / "templates"))

View file

@ -4,9 +4,9 @@ from datetime import UTC, datetime
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User, WebAuthnCredential
from tests.conftest import get_csrf_token
async def _create_user_and_login(client: AsyncClient) -> str:

View file

@ -3,9 +3,9 @@ from datetime import UTC, datetime
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
async def _login(client: AsyncClient, username: str = "alice", password: str = "testpass") -> None:

View file

@ -3,9 +3,9 @@ from datetime import UTC, datetime
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User, WebAuthnCredential
from tests.conftest import get_csrf_token
async def _create_user_and_login(client: AsyncClient) -> str:

View file

@ -17,9 +17,9 @@ from fido2.webauthn import (
)
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User, WebAuthnCredential
from tests.conftest import get_csrf_token
RP_ID = "localhost"
ORIGIN = "http://localhost:8000"

View file

@ -3,9 +3,9 @@ from datetime import UTC, datetime
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
async def test_password_login_unknown_user_returns_error_fragment(client: AsyncClient) -> None:

View file

@ -6,8 +6,8 @@ from fido2.cose import ES256
from fido2.webauthn import Aaguid, AttestedCredentialData
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.models import User, WebAuthnCredential
from tests.conftest import get_csrf_token
RP_ID = "localhost"
ORIGIN = "http://localhost:8000"

View file

@ -5,9 +5,9 @@ from urllib.parse import parse_qs, urlparse
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
async def test_authorization_shows_consent_for_new_client(client: AsyncClient) -> None:

View file

@ -9,9 +9,9 @@ from cryptojwt.jwk.jwk import key_from_jwk_dict
from cryptojwt.jws.jws import JWS
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
async def test_full_authorization_code_flow(client: AsyncClient) -> None:

View file

@ -4,9 +4,9 @@ from datetime import UTC, datetime
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
def _register_test_client(client: AsyncClient) -> None:

View file

@ -6,9 +6,9 @@ from urllib.parse import parse_qs, urlparse
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
def _register_test_client(client: AsyncClient) -> str:

View file

@ -6,9 +6,9 @@ from urllib.parse import parse_qs, urlparse
from argon2 import PasswordHasher
from httpx import AsyncClient
from tests.conftest import get_csrf_token
from porchlight.authn.password import PasswordService
from porchlight.models import PasswordCredential, User
from tests.conftest import get_csrf_token
def _register_test_client(client: AsyncClient) -> str: