strongmind-auth 1.1.67 → 1.1.72

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: 319ca5e561b4d889987f1ee237c122931973142e21c3d9fd914f96f72579dd2f
4
- data.tar.gz: a5c83542ca17517d3b3441873d8506340cb1be3c8e678c0b0acd13733cb321c1
3
+ metadata.gz: f1e3fd18ae6d5878a6429567c72e2d50553b364b31924b9f8788049c0d58a186
4
+ data.tar.gz: b30f49a52fe570523ebcf7d9a432240e35de4d98e30dd22d17ce0102621bf06f
5
5
  SHA512:
6
- metadata.gz: 26e4ca94443076c7c8eacf8b315b532a67dad8fd035d5a54ca57d04c02c3595ccf8a500b6b5a562481ea2241a4d7ddc67d092929226aaa0e651ebd9507dfc2fe
7
- data.tar.gz: 4bfac1ab1bf62a526270833e1fcae7330cab2f66bf80f64862f3e70a22756c0219580011e089e5f949d7c704a1a60536984c5c2d0b4488baa6f30b87d6a126c9
6
+ metadata.gz: 28079c7c3ab3a185bfaa113417ef3f6ca08bb5c37b2c4f88496e948161f4a5826d89675e9b18babb161b9cdf16e9d9e3930f691578d3c11c27cfbeb1607bfc07
7
+ data.tar.gz: c15fd8c8a595ef35c308d103801015621f4c341e1725c3f90e99a4e42aaba3360a3ffdff85d006e8d63293a2c1651f4195bd8101f891b91c2c8680cf00d26573
@@ -11,7 +11,7 @@ module StrongMindNav
11
11
  @top_navbar_html = navbar[:top_navbar_html]
12
12
  @bottom_navbar_html = navbar[:bottom_navbar_html]
13
13
  @theme_css = navbar[:theme_css]
14
- rescue Strongmind::Exceptions::TokenNotFoundError, Strongmind::Exceptions::UserNotFoundError, Strongmind::Exceptions::RefreshTokenExpiredError => e
14
+ rescue Strongmind::Exceptions::NilSessionError, Strongmind::Exceptions::TokenNotFoundError, Strongmind::Exceptions::UserNotFoundError, Strongmind::Exceptions::RefreshTokenExpiredError => e
15
15
  Sentry.capture_exception(e)
16
16
  Rails.logger.error(e)
17
17
  flash[:alert] = e.inspect if Rails.env.development? || Rails.env.test?
@@ -1,5 +1,5 @@
1
1
  module Strongmind
2
2
  module Auth
3
- VERSION = "1.1.67"
3
+ VERSION = "1.1.72"
4
4
  end
5
5
  end
@@ -48,8 +48,8 @@ module Strongmind
48
48
  end
49
49
 
50
50
  def fetch_navbar_data(nav_items)
51
- access_token = token
52
51
  refresh_session
52
+ access_token = token
53
53
 
54
54
  connection.post(navbar_endpoint, nav_items.to_json, 'Authorization' => "Bearer #{access_token}")
55
55
  end
@@ -75,8 +75,12 @@ module Strongmind
75
75
 
76
76
  def refresh_session
77
77
  session = Rails.cache.fetch(user.uid)
78
+ unless session&.key?(:access_token)
79
+ raise Strongmind::Exceptions::NilSessionError, "Session not found for user #{user.uid}"
80
+ end
81
+
78
82
  auth_client.refresh_session(session:)
79
- Rails.cache.write(user.uid, session)
83
+ Rails.cache.write(user.uid, session, expires_in: session[:expires_in].to_i.seconds - 10.minutes)
80
84
  rescue PlatformSdk::Identity::ClientError => e
81
85
  handle_refresh_error(e)
82
86
  end
@@ -5,5 +5,7 @@ module Strongmind
5
5
  class UserNotFoundError < StandardError; end
6
6
 
7
7
  class RefreshTokenExpiredError < StandardError; end
8
+
9
+ class NilSessionError < StandardError; end
8
10
  end
9
11
  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.67
4
+ version: 1.1.72
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-04-05 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails