strongmind-auth 1.1.70 → 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: 62f26f042ed3981f261550a4d15685cb83d63c6f6140fe7ecfa232f4cb2594e1
4
- data.tar.gz: f81421faeedb5e7fa3bf2f32336c18641cc40d65795f5d480f978d3bc38eacbc
3
+ metadata.gz: f1e3fd18ae6d5878a6429567c72e2d50553b364b31924b9f8788049c0d58a186
4
+ data.tar.gz: b30f49a52fe570523ebcf7d9a432240e35de4d98e30dd22d17ce0102621bf06f
5
5
  SHA512:
6
- metadata.gz: 17c6adf570d424c3a26ea007fce2373207c0992ce738107ce9b38ad0e094ff7e036d84e5484f24e5b8dfb415d33a9d7b1b6e8c5602b263919c8339dff691694e
7
- data.tar.gz: '0310901e9e6618ca6ccb356d637a68231da2e321f92dac35d88994fab6123ed2299cdec7c2be7bedfd0145c48294aa11e032cb432a2d248f950a232c894208fc'
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.70"
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,6 +75,10 @@ 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
83
  Rails.cache.write(user.uid, session, expires_in: session[:expires_in].to_i.seconds - 10.minutes)
80
84
  rescue PlatformSdk::Identity::ClientError => e
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.70
4
+ version: 1.1.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Belding