Skip to content

Commit

Permalink
Allow the user_class and serializer_class to be specified in the cons…
Browse files Browse the repository at this point in the history
…tructor

This is a slightly more convenient API.
  • Loading branch information
pgjones committed May 18, 2024
1 parent 8c3bdc4 commit 1aa96b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/quart_auth/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from contextlib import asynccontextmanager
from enum import auto, Enum
from hashlib import sha512
from typing import Any, AsyncGenerator, cast, Dict, Literal, Optional, Union
from typing import Any, AsyncGenerator, cast, Dict, Literal, Optional, Type, Union

from itsdangerous import BadSignature, SignatureExpired, URLSafeTimedSerializer
from quart import (
Expand Down Expand Up @@ -92,6 +92,8 @@ def __init__(
mode: Optional[Literal["cookie", "bearer"]] = None,
salt: Optional[str] = None,
singleton: bool = True,
serializer_class: Type[_AuthSerializer] = _AuthSerializer,
user_class: Type[AuthUser] = AuthUser,
) -> None:
self.attribute_name = attribute_name
self.cookie_domain = cookie_domain
Expand All @@ -104,6 +106,8 @@ def __init__(
self.mode = mode
self.salt = salt
self.singleton = singleton
self.serializer_class = serializer_class
self.user_class = user_class
if app is not None:
self.init_app(app)

Expand Down

0 comments on commit 1aa96b5

Please sign in to comment.