strongmind-auth 1.1.102 → 1.1.107
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fb08b31a5fa67f9ea7ea76871e6a7ebacf053bec0301b5dc769187db2cb9e77
|
4
|
+
data.tar.gz: 9c0d495a487895e7abc6a950228eebd7c6def1917cf4e87ba6bd0fde9b5dc4f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc4ea71c018cc9e30fdb3d6eec44e4c1f5c0edcf91b6ca9d0b8b167c586b411af87dff2356008c330cfb4d6e313413c58a2dd24a3b49fc705a5ea5ec7becaa22
|
7
|
+
data.tar.gz: 522cbc63024c6f6aa8d8a885a3519bebb3a322dcfbe25fb88e36dded321aa91229a9f5d44b2160e2ac85132b0c5ea8d82ff2ddc4db72a12bcbb4d753d969daf8
|
@@ -4,12 +4,13 @@ require "strongmind/exceptions"
|
|
4
4
|
module StrongMindNav
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
+
NAVBAR_CACHE_KEY_SUFFIX = 'navbar'
|
8
|
+
|
7
9
|
def fetch_common_nav
|
8
10
|
begin
|
9
11
|
nav_items = build_nav_items
|
10
12
|
|
11
|
-
user_cache_key_encoded =
|
12
|
-
|
13
|
+
user_cache_key_encoded = generate_user_navbar_cache_key(nav_items)
|
13
14
|
navbar = Rails.cache.fetch(user_cache_key_encoded, expires_in: 1.day) do
|
14
15
|
Strongmind::CommonNavFetcher.new(current_user).retrieve(nav_items, common_nav_options)
|
15
16
|
end
|
@@ -75,15 +76,27 @@ module StrongMindNav
|
|
75
76
|
path_to_compare.include?(sanitized_path) || path_to_compare.include?(sanitized_path.pluralize)
|
76
77
|
end
|
77
78
|
|
78
|
-
def
|
79
|
+
def generate_user_navbar_cache_key(nav_items)
|
79
80
|
navbar_options_cache_key = nav_items.to_json
|
80
81
|
|
81
82
|
user_cache_key = if current_user.respond_to?(:selected_role_id)
|
82
|
-
"
|
83
|
+
role = "role_#{current_user.selected_role_id}"
|
84
|
+
|
85
|
+
[role, navbar_options_cache_key].join('_')
|
83
86
|
else
|
84
|
-
|
87
|
+
navbar_options_cache_key
|
85
88
|
end
|
86
89
|
|
87
|
-
Digest::SHA256.hexdigest(user_cache_key)
|
90
|
+
navbar_cache_key_prefix(current_user) + Digest::SHA256.hexdigest(user_cache_key) + NAVBAR_CACHE_KEY_SUFFIX
|
91
|
+
end
|
92
|
+
|
93
|
+
def invalidate_navbar_cache(user = current_user)
|
94
|
+
cache_key_matcher = navbar_cache_key_prefix(user) + "*" + NAVBAR_CACHE_KEY_SUFFIX
|
95
|
+
|
96
|
+
Rails.cache.delete_matched(cache_key_matcher)
|
97
|
+
end
|
98
|
+
|
99
|
+
def navbar_cache_key_prefix(user)
|
100
|
+
"user_#{user.uid}"
|
88
101
|
end
|
89
102
|
end
|
@@ -24,6 +24,7 @@ module Users
|
|
24
24
|
user_identity = payload['sub']
|
25
25
|
user = User.find_by(uid: user_identity)
|
26
26
|
user.invalidate_all_sessions!
|
27
|
+
invalidate_navbar_cache(user)
|
27
28
|
render json: {}, status: :ok, headers:
|
28
29
|
else
|
29
30
|
render json: {}, status: :bad_request, headers:
|
@@ -36,6 +37,7 @@ module Users
|
|
36
37
|
|
37
38
|
id_token_hint = user_token_info[:id_token]
|
38
39
|
current_user&.invalidate_all_sessions!
|
40
|
+
invalidate_navbar_cache
|
39
41
|
identity_base_url = ENV['IDENTITY_BASE_URL']
|
40
42
|
redirect_to "#{identity_base_url}/connect/endsession?id_token_hint=#{id_token_hint}", allow_other_host: true
|
41
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongmind-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.107
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Belding
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|