|
12 | 12 |
|
13 | 13 | from abc import ABC, abstractmethod |
14 | 14 | from datetime import datetime, timezone |
15 | | -from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generic, TypeVar |
| 15 | +from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generic, TypeVar, Union |
16 | 16 |
|
17 | 17 | import jwskate |
18 | 18 | from attr import asdict, field, frozen |
@@ -84,12 +84,10 @@ class BearerTokenSerializer(Serializer[BearerToken]): |
84 | 84 | This may be used to store BearerTokens in session or cookies. |
85 | 85 |
|
86 | 86 | It needs a `dumper` and a `loader` functions that will respectively serialize and deserialize |
87 | | - BearerTokens. Default implementations are provided with use gzip and base64url on the serialized |
88 | | - JSON representation. |
| 87 | + BearerTokens (or subclasses). |
89 | 88 |
|
90 | | - Args: |
91 | | - dumper: a function to serialize a token into a `str`. |
92 | | - loader: a function to deserialize a serialized token representation. |
| 89 | + Default implementation uses gzip and base64url on the serialized JSON representation. |
| 90 | + It supports `BearerToken` and `DPoPToken` instances. |
93 | 91 |
|
94 | 92 | """ |
95 | 93 |
|
@@ -202,12 +200,14 @@ def default_loader( |
202 | 200 |
|
203 | 201 | @frozen |
204 | 202 | class AuthorizationRequestSerializer( |
205 | | - Serializer[AuthorizationRequest | RequestParameterAuthorizationRequest | RequestUriParameterAuthorizationRequest] |
| 203 | + Serializer[ |
| 204 | + Union[AuthorizationRequest, RequestParameterAuthorizationRequest, RequestUriParameterAuthorizationRequest] |
| 205 | + ] |
206 | 206 | ): |
207 | 207 | """(De)Serializer for `AuthorizationRequest` instances. |
208 | 208 |
|
209 | | - You might need to store pending authorization requests in session, either server-side or client- side. This class is |
210 | | - here to help you do that. |
| 209 | + Default implementation supports `AuthorizationRequest`, `RequestParameterAuthorizationRequest`, and |
| 210 | + `RequestUriParameterAuthorizationRequest`. |
211 | 211 |
|
212 | 212 | """ |
213 | 213 |
|
|
0 commit comments