mn_utils_gem 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mn_utils_gem/sso.rb +9 -2
- data/lib/mn_utils_gem/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: d9028f4817b34f754f151982e8ec04b86f429d54925c330934fb95284377b703
|
4
|
+
data.tar.gz: 640fe992340fa890bbf62600c605116993e5fbf32517538331f65a3bcbf59706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f320fbe918b67ab8d01f775a58489c5ecebe5713d60908d850e487652200ecc427e2eaf5efb35ce9823ae1e1662dc4eac7f0c1032ed075455925ffb2ca45cac6
|
7
|
+
data.tar.gz: 2f9cc5ebe5081215b9b5e05411e0edcbbc66138db249fecf42c152b104b174316aa7ed5d175afc38eede10c00939aa5e90ae159945d2116aba5fabd0adaf4bf3
|
data/lib/mn_utils_gem/sso.rb
CHANGED
@@ -23,11 +23,13 @@ module MnUtilsAuth
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_sso(cookies)
|
26
|
+
return RequestStore.store[:sso] if RequestStore.store[:sso]
|
26
27
|
return nil if cookies.nil? || cookies[SSO_COOKIE_NAME].nil? || redis_server.nil?
|
27
28
|
json = redis_server.get(cookies[SSO_COOKIE_NAME].to_s)
|
28
29
|
return nil if json.nil?
|
29
30
|
parsed = JSON.parse(json, symbolize_names: true)
|
30
31
|
return nil unless parsed.is_a?(Hash)
|
32
|
+
RequestStore.store[:sso] = parsed
|
31
33
|
parsed
|
32
34
|
rescue Exception => e
|
33
35
|
@logger.error e
|
@@ -35,10 +37,12 @@ module MnUtilsAuth
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def set_sso(cookies, user_id, other_attributes = {})
|
38
|
-
return if cookies.nil? || user_id.blank? || redis_server.nil?
|
40
|
+
return if cookies.nil? || user_id.blank? || redis_server.nil? || RequestStore.store[:sso]
|
39
41
|
if cookies[SSO_COOKIE_NAME].nil?
|
40
42
|
cookie = set_sso_cookie cookies
|
41
|
-
|
43
|
+
value = other_attributes.reverse_merge({ user_id: user_id })
|
44
|
+
redis_server.set(cookie, JSON[value])
|
45
|
+
RequestStore.store[:sso] = value
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
@@ -47,6 +51,9 @@ module MnUtilsAuth
|
|
47
51
|
redis_server.del(cookies[SSO_COOKIE_NAME])
|
48
52
|
cookies.delete SSO_COOKIE_NAME
|
49
53
|
end
|
54
|
+
if RequestStore.store[:sso]
|
55
|
+
RequestStore.store[:sso] = nil
|
56
|
+
end
|
50
57
|
end
|
51
58
|
|
52
59
|
private
|
data/lib/mn_utils_gem/version.rb
CHANGED