oauth_im 0.13.2 → 0.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: d151de8c9c45dbbe2a8e5a92eca440e59e770432d57b51895982f0ed36d40aa8
4
- data.tar.gz: 4b3a5b694824aea1d6456f2efec755b8cbf91209601d9c8e383db5d45dd484bf
3
+ metadata.gz: cbc27c0f6156c8c268aa642b7bb93ec558df3242ba4935bf6108d25b943e22a7
4
+ data.tar.gz: bd9bcc76ee46fef4b1d592bf6ad1f27d847aac830195e82d13c878009858fb0c
5
5
  SHA512:
6
- metadata.gz: 3ea7f1c9800b99a69fd527915c10d9204a47dc13bbcd894b0bb73fab378d68992d14a69f69717a9fda56d86a52e6a3097ab8beeb47990c41fc8c753f43c3a1dd
7
- data.tar.gz: a598389dbe4346711a9aed715b41b215a24074eca9b3115b0a27ebe88f5d79aaf84d732cd4e12b12420ddc61b41c954f665278293c390c1dec37b7fbc622060d
6
+ metadata.gz: b00319d1bf052c6bcfbceac00337ee736d029f797be234dbe96e90c0d02a266dff7382a7075779947aec7b5f3dd448fbd366b84baff2ffa41b8803885cdc32fe
7
+ data.tar.gz: eb03efb12c05c9f5785ce4cb5d852a940f082c269decc536ffe2bcb98698931a742c885f92db1b666c0bed51d88d5c214a3f9295dab76f537aced0cd0b965de4
@@ -9,13 +9,27 @@ module OauthIm
9
9
 
10
10
  def callback
11
11
  session[:user_jwt] = user_jwt
12
- redirect_to main_app.root_path
12
+ callback_redirect
13
13
  rescue StandardError => e
14
14
  Rollbar.warning "rescue OauthIm::ClientController#callback: #{request.original_url} #{e.message}"
15
15
  redirect_to oauth_rescue_redirect_path
16
16
  end
17
17
 
18
+ def callback_redirect
19
+ # Fetch the original page the user was on just prior to logging in.
20
+ # If it's not available, default to the root path.
21
+ referer_path = session.fetch(:oauth_im_login_referer, '').strip
22
+ if referer_path.empty?
23
+ redirect_to main_app.root_path
24
+ else
25
+ redirect_to referer_path
26
+ end
27
+ end
28
+
18
29
  def login
30
+ # Set the referer path, if available, so that we can put the user
31
+ # back on the page they were at before they decided the log in.
32
+ session[:oauth_im_login_referer] = request.referer
19
33
  redirect_to oauth_client.login_url
20
34
  end
21
35
 
@@ -25,7 +25,9 @@ module OauthIm
25
25
  jwt_token[:roles].include? 'admin'
26
26
  end
27
27
 
28
- alias current_user_id user_id
28
+ def current_user_id
29
+ @current_user_id ||= jwt_token[:sub]
30
+ end
29
31
 
30
32
  private
31
33
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OauthIm
4
- VERSION = '0.13.2'
4
+ VERSION = '0.14.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Connally
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusionauth_client