zaikio-jwt_auth 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/zaikio/jwt_auth/configuration.rb +1 -1
- data/lib/zaikio/jwt_auth/directory_cache.rb +4 -4
- data/lib/zaikio/jwt_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c782ad558e422167c59f3c29dfdd9533d97153a17f05955a12eb127e32d55a68
|
4
|
+
data.tar.gz: 063fc86f98d24d70e496f324ccc87ec32f71f61ba50c91a70708ca20afe8b1c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b24750a7edda299537d85f6bf852a85aaba442f77a18d6c9998d3ef491fa1b329b843b23ddc7b2b6f309ab3abac2c94e0448eef2c7370a9a59014e8823add84
|
7
|
+
data.tar.gz: 8b39b2cdaa531bb985b59a374584e6ba2d0167213f9e70185be84462843044478026bc74b8d24e972cd840e1a4402a8ff5390245948fd0b3393ebb1ccc31baa7
|
data/README.md
CHANGED
@@ -28,7 +28,9 @@ $ gem install zaikio-jwt_auth
|
|
28
28
|
Zaikio::JWTAuth.configure do |config|
|
29
29
|
config.environment = :sandbox # or production
|
30
30
|
config.app_name = "test_app" # Your Zaikio App-Name
|
31
|
-
|
31
|
+
|
32
|
+
# Enable caching Hub API responses for e.g. revoked tokens
|
33
|
+
config.cache = Rails.cache
|
32
34
|
end
|
33
35
|
```
|
34
36
|
|
@@ -183,6 +185,13 @@ rescue JWT::DecodeError, JWT::ExpiredSignature
|
|
183
185
|
end
|
184
186
|
```
|
185
187
|
|
188
|
+
### Using a different cache backend
|
189
|
+
|
190
|
+
This client supports any implementation of
|
191
|
+
[`ActiveSupport::Cache::Store`](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html),
|
192
|
+
but you can also write your own client that supports these methods: `#read(key)`,
|
193
|
+
`#write(key, value)`, `#delete(key)`
|
194
|
+
|
186
195
|
## Contributing
|
187
196
|
|
188
197
|
**Make sure you have the dummy app running locally to validate your changes.**
|
@@ -16,7 +16,7 @@ module Zaikio
|
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def fetch(directory_path, options = {})
|
19
|
-
cache = Zaikio::JWTAuth.configuration.
|
19
|
+
cache = Zaikio::JWTAuth.configuration.cache.read("zaikio::jwt_auth::#{directory_path}")
|
20
20
|
|
21
21
|
json = Oj.load(cache) if cache
|
22
22
|
|
@@ -31,14 +31,14 @@ module Zaikio
|
|
31
31
|
def update(directory_path, options = {})
|
32
32
|
data = fetch(directory_path, options)
|
33
33
|
data = yield(data)
|
34
|
-
Zaikio::JWTAuth.configuration.
|
34
|
+
Zaikio::JWTAuth.configuration.cache.write("zaikio::jwt_auth::#{directory_path}", {
|
35
35
|
fetched_at: Time.now.to_i,
|
36
36
|
data: data
|
37
37
|
}.to_json)
|
38
38
|
end
|
39
39
|
|
40
40
|
def reset(directory_path)
|
41
|
-
Zaikio::JWTAuth.configuration.
|
41
|
+
Zaikio::JWTAuth.configuration.cache.delete("zaikio::jwt_auth::#{directory_path}")
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
@@ -49,7 +49,7 @@ module Zaikio
|
|
49
49
|
|
50
50
|
def reload_or_enqueue(directory_path)
|
51
51
|
data = fetch_from_directory(directory_path)
|
52
|
-
Zaikio::JWTAuth.configuration.
|
52
|
+
Zaikio::JWTAuth.configuration.cache.write("zaikio::jwt_auth::#{directory_path}", {
|
53
53
|
fetched_at: Time.now.to_i,
|
54
54
|
data: data
|
55
55
|
}.to_json)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zaikio-jwt_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crispymtn
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-04-
|
13
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activejob
|