Skip to content

Commit 2bc8c38

Browse files
committed
Fix Fab auth manager with securecookie as session backend
1 parent 1aff29f commit 2bc8c38

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

providers/fab/src/airflow/providers/fab/www/session.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@
2424

2525

2626
class _LazySafeSerializer:
27-
def encode(self, session_dict):
27+
def dumps(self, session_dict):
2828
encoder = msgspec.msgpack.Encoder(
2929
enc_hook=lambda obj: str(obj) if isinstance(obj, LazyString) else obj
3030
)
31-
3231
return encoder.encode(dict(session_dict))
3332

34-
def decode(self, data):
33+
def loads(self, data):
3534
decoder = msgspec.msgpack.Decoder()
36-
3735
return decoder.decode(data)
3836

39-
def _default(self, obj):
40-
if isinstance(obj, LazyString):
41-
return str(obj)
42-
raise TypeError(f"Unsupported type: {type(obj)}")
37+
# optional old API
38+
encode = dumps
39+
decode = loads
4340

4441

4542
class SessionExemptMixin:

providers/fab/www-hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
337fac0d595edf73281ba03d11d6a6b88a41cc5010ce8e74ed8dd0c9ea84f5b8
1+
54eed6a60379d3648bce797254dac3b1556c6315c35fe1bcc9b0868346cd5523

0 commit comments

Comments
 (0)