clowk 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clowk/authenticable.rb +16 -2
- data/lib/clowk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1aad1a920ab61f2ff4a89d52ceede9e30edf63a92f2fa5cb60e99eb3032f5a39
|
|
4
|
+
data.tar.gz: a701bfc46f4c2ae7c2bc57d731ab9a9ff4dde4dc454fc0634e8b1d6a08603b80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd7bb4bc6f95eb20c9cdabbb5f7e1dd1664f5d2566b895bd0e7466c46821ee7262b25bea0ced1aaf21e4ae8fa858ada4b28161d5517d7241f8ec31607ef5cae8
|
|
7
|
+
data.tar.gz: e0d6c2d830d16cc85c003c114240e0b2270f7de8288d85f1eb4b5d564613d8681c1d484a37fcf36a76908f44f6e9d3b9579d2890d4e3abf4cc84917375c2d03e
|
data/lib/clowk/authenticable.rb
CHANGED
|
@@ -291,7 +291,22 @@ module Clowk
|
|
|
291
291
|
store.read(clowk_status_cache_key)&.deep_symbolize_keys
|
|
292
292
|
end
|
|
293
293
|
|
|
294
|
+
# A TTL of zero means "never trust a cached status", so there is nothing to
|
|
295
|
+
# write anywhere — the read side already discards whatever is there
|
|
296
|
+
# (clowk_session_status_fresh? is false without a positive TTL).
|
|
297
|
+
#
|
|
298
|
+
# The guard used to sit below the session branch and cover only the external
|
|
299
|
+
# cache, so an app that set the TTL to zero — to guarantee a genuinely fresh
|
|
300
|
+
# check before a destructive action — still had the full status payload
|
|
301
|
+
# written into its session on every single request, and never read back.
|
|
302
|
+
# That is write-only weight in a cookie with 4096 bytes to live in, and it
|
|
303
|
+
# ends as ActionDispatch::Cookies::CookieOverflow on whichever request
|
|
304
|
+
# happens to add a flash message.
|
|
294
305
|
def clowk_write_cached_session_status(status)
|
|
306
|
+
ttl = Clowk.config.session_status_ttl.to_i
|
|
307
|
+
|
|
308
|
+
return unless ttl.positive?
|
|
309
|
+
|
|
295
310
|
if clowk_session_store
|
|
296
311
|
clowk_session_store[Clowk.config.session_key] = stored_session.merge(
|
|
297
312
|
"session_status" => status,
|
|
@@ -301,10 +316,9 @@ module Clowk
|
|
|
301
316
|
return
|
|
302
317
|
end
|
|
303
318
|
|
|
304
|
-
ttl = Clowk.config.session_status_ttl.to_i
|
|
305
319
|
store = clowk_status_cache
|
|
306
320
|
|
|
307
|
-
return unless store
|
|
321
|
+
return unless store
|
|
308
322
|
|
|
309
323
|
store.write(clowk_status_cache_key, status, expires_in: ttl)
|
|
310
324
|
end
|
data/lib/clowk/version.rb
CHANGED