clowk 0.7.1 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33d1a92eb50a3515f9c312ccd3ba71dbc9bedfd11935797f70497aa076dbb55b
4
- data.tar.gz: 38aa689ff1303246487acaad73cf02c34955bafa9a44bc44544b6ce289e758a3
3
+ metadata.gz: b8925255001baaeae3fb7507651c4fa65ba8ccb24358a593c191f5e3a0070b2a
4
+ data.tar.gz: f6acd810ff58c1410c67c8b78c4db705966fa8643d39fef2673da25816c006c8
5
5
  SHA512:
6
- metadata.gz: b334fda452268ee1ae58a897ddbd07dfe6c0f715f4a2693ddadffbeb882af3d906bf4e76ce655160eb5c204c2de6d175c596ecc182b4261ef9edfc21c31f6b51
7
- data.tar.gz: 4516f8fdc4dd79291fa895c2a203d7920b3d44ee69bf89f1a8c3f11877f65e36d1e8dd70b67b5a99c49462e15c07d33f25b42d85466fd87f44e2a3244745248e
6
+ metadata.gz: d61ceac58f3444d2cf6cf0af582d595a115c0971048ad7a2e979611cc45a4020bbc1a3689fccf33144ccc3d28bbc7cfbc32cb1bd870de94f43cede1289cd9aea
7
+ data.tar.gz: 538f167b4d02d928f9cd231fadbbb8e8a7639b2648903e5f46da1414b058b376e5dd9ce926ab47cbb1fbc1aeacbdce748d5ef8bb6d24ea8c6ec00fd90f941685
data/README.md CHANGED
@@ -239,15 +239,18 @@ those actions and they get a live one:
239
239
 
240
240
  ```ruby
241
241
  class ApiKeysController < ApplicationController
242
- clowk_require_fresh_session only: [:create, :update, :destroy]
242
+ before_action :clowk_enforce_fresh_session!, only: [:create, :update, :destroy]
243
243
  end
244
244
  ```
245
245
 
246
- It takes the same options as `before_action`. Everything not named keeps the
247
- cached check, so an app pays for the round trip on the few actions it cannot
248
- undo and nowhere else. `clowk_enforce_fresh_session!` is the same thing as a
249
- method, and `clowk_session_active?(force: true)` returns the answer instead of
250
- enforcing it.
246
+ An ordinary `before_action`, so the filter options you already know all work.
247
+ Everything not named keeps the cached check, so an app pays for the round trip on
248
+ the few actions it cannot undo and nowhere else.
249
+
250
+ Under a configured `prefix_by` the method is named for the scope, like every
251
+ other one here — `clowk_user_enforce_fresh_session!` beside
252
+ `clowk_user_enforce_session!`. And `clowk_session_active?(force: true)` returns
253
+ the answer instead of enforcing it.
251
254
 
252
255
  Two settings decide what happens when Clowk itself cannot be reached:
253
256
 
@@ -67,22 +67,6 @@ module Clowk
67
67
  Clowk::Authenticable.install_dynamic_methods(self)
68
68
  end
69
69
 
70
- class_methods do
71
- # Demand a live answer from Clowk before these actions, whatever a cached
72
- # status says.
73
- #
74
- # class ApiKeysController < ApplicationController
75
- # clowk_require_fresh_session only: [:create, :update, :destroy]
76
- # end
77
- #
78
- # Takes the same options as before_action. Everything NOT listed keeps the
79
- # cached check, which is the point: an app pays for a round trip on the few
80
- # actions that cannot be undone, and nowhere else.
81
- def clowk_require_fresh_session(**options)
82
- before_action(**options) { clowk_enforce_fresh_session! }
83
- end
84
- end
85
-
86
70
  # Per-request credentials — for apps whose keys are not a boot constant:
87
71
  # an operator pastes a publishable key into a settings screen, or one
88
72
  # process serves several tenants.
@@ -143,7 +127,10 @@ module Clowk
143
127
  # rotating a secret, deleting an account, removing a member. Everything else
144
128
  # should take the cached check — this is a round trip, on purpose.
145
129
  #
146
- # clowk_require_fresh_session only: [:destroy, :rotate_secret]
130
+ # before_action :clowk_enforce_fresh_session!, only: [:destroy]
131
+ #
132
+ # Under a configured prefix_by it is named for the scope, like every other
133
+ # method here: `clowk_user_enforce_fresh_session!`.
147
134
  #
148
135
  # Before 0.7 the only way to get this was `session_status_ttl = 0`, which
149
136
  # bought freshness here by paying a round trip on every page instead.
data/lib/clowk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clowk
4
- VERSION = "0.7.1"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clowk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clowk