Skip to content

Commit 1aa96b5

Browse files
committed
Allow the user_class and serializer_class to be specified in the constructor
This is a slightly more convenient API.
1 parent 8c3bdc4 commit 1aa96b5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/quart_auth/extension.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from contextlib import asynccontextmanager
33
from enum import auto, Enum
44
from hashlib import sha512
5-
from typing import Any, AsyncGenerator, cast, Dict, Literal, Optional, Union
5+
from typing import Any, AsyncGenerator, cast, Dict, Literal, Optional, Type, Union
66

77
from itsdangerous import BadSignature, SignatureExpired, URLSafeTimedSerializer
88
from quart import (
@@ -92,6 +92,8 @@ def __init__(
9292
mode: Optional[Literal["cookie", "bearer"]] = None,
9393
salt: Optional[str] = None,
9494
singleton: bool = True,
95+
serializer_class: Type[_AuthSerializer] = _AuthSerializer,
96+
user_class: Type[AuthUser] = AuthUser,
9597
) -> None:
9698
self.attribute_name = attribute_name
9799
self.cookie_domain = cookie_domain
@@ -104,6 +106,8 @@ def __init__(
104106
self.mode = mode
105107
self.salt = salt
106108
self.singleton = singleton
109+
self.serializer_class = serializer_class
110+
self.user_class = user_class
107111
if app is not None:
108112
self.init_app(app)
109113

0 commit comments

Comments
 (0)