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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc951b6447f533eb913ad2e69d94a30e18de54a44678fa5aec138d97aa891089
4
- data.tar.gz: 37b4f3d995e9fd5cfe864ee3f3ce8841c31cff76a25b5d0fa0a6003d0e09529e
3
+ metadata.gz: d9028f4817b34f754f151982e8ec04b86f429d54925c330934fb95284377b703
4
+ data.tar.gz: 640fe992340fa890bbf62600c605116993e5fbf32517538331f65a3bcbf59706
5
5
  SHA512:
6
- metadata.gz: dc4f6fe72838e4745875b2e3f2cb2809578eab86632df52242a5a0ee131671d02a8ddf8ba2b275bc05160bee4ba776f4253418ccf7ba892fbec2ced4883c0862
7
- data.tar.gz: 85738b850340c890e770b32bb037bbeb2652def06b0259e91a081df8181c73da674a1539661088529dd5bf4b6c47656e61133aa652e990c29f6ba81f466dc472
6
+ metadata.gz: f320fbe918b67ab8d01f775a58489c5ecebe5713d60908d850e487652200ecc427e2eaf5efb35ce9823ae1e1662dc4eac7f0c1032ed075455925ffb2ca45cac6
7
+ data.tar.gz: 2f9cc5ebe5081215b9b5e05411e0edcbbc66138db249fecf42c152b104b174316aa7ed5d175afc38eede10c00939aa5e90ae159945d2116aba5fabd0adaf4bf3
@@ -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
- redis_server.set(cookie, JSON[other_attributes.reverse_merge({ user_id: user_id })])
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
@@ -1,3 +1,3 @@
1
1
  module MnUtilsGem
2
- VERSION = "1.13.0"
2
+ VERSION = "1.14.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn_utils_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shamim Mirzai