go_sso 0.4.2 → 0.5.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: 74e802c1f65aec69060e5b79aa378ab4d2470c0a4f3adf7466add39a2875c569
4
- data.tar.gz: 60a13a8e3b6045086887e3c1687cf5ae7f03f677d47eee2fc630b19c28a91a01
3
+ metadata.gz: 904cedd809a2f4bb6f9ddc5ab11b8ed3cae039228ab577d69179141b0cdaf1e5
4
+ data.tar.gz: 1f5e0e051a65b642a2cd67451fed20331addafd217f9743811fc737128debb13
5
5
  SHA512:
6
- metadata.gz: 17746ae23a5d433886c56c60b922cb7a43b0abcab8a4f8907badac7107000b2252a3066a951094540a2217515139c303f2dae8830c54fcbd346c46fda4289dca
7
- data.tar.gz: 88136bf0a22d248db516aded9bd146efd6c0d3bfbe5458119144604e71e9f00b2d440e49fb1de0fdc706ed725ff1acd24096dbec5a0fa9f28a33ba607a98d19a
6
+ metadata.gz: '079edece6cd52dc37af2f776c93dcbf25f98c33761d05b1b9aaa5fe2157257fbfb8a5680d0eb335208a643f69a1db9a7c6dd0f038cd44ac4e8b3c7eb075ab644'
7
+ data.tar.gz: b19abc01a2637483138f1c11d420eb34f004118e9494b45dff14b173c16dda5ecb0c9a02e989eb3de80cea6936dbaf287484e3bb6ef61f0d891df5a56104ddd2
@@ -26,7 +26,7 @@ module GoSso
26
26
 
27
27
  def authenticate_sso_user_permission
28
28
  unless current_sso_user
29
- return redirect_to(go_sso_auth_url(redirect_url: request.url))
29
+ return redirect_to(main_app.go_sso_auth_url(redirect_url: request.url))
30
30
  end
31
31
 
32
32
  unless current_sso_user.can_access?(GoSso.main_app_module_name)
@@ -34,8 +34,9 @@ module GoSso
34
34
 
35
35
  def request_call
36
36
  session[:go_sso_referrer] = request.params["redirect_url"] || request.referrer || request.base_url
37
+
37
38
  if GoSso.test_mode?
38
- redirect callback_path
39
+ redirect client_callback_path
39
40
  else
40
41
  redirect GoSso.authorize_url
41
42
  end
@@ -54,18 +55,16 @@ module GoSso
54
55
  fail!({ code: error.code, description: error.description })
55
56
  end
56
57
 
57
- def callback_path
58
- "#{GoSso.routes_prefix}/callback"
58
+ def client_callback_path
59
+ path_with_script_name("#{GoSso.routes_prefix}/callback")
59
60
  end
60
61
 
61
62
  def on_path?(path)
62
63
  current_path.casecmp(path).zero?
63
64
  end
64
65
 
65
- CURRENT_PATH_REGEX = %r{/$}.freeze
66
- EMPTY_STRING = ''.freeze
67
66
  def current_path
68
- @current_path ||= request.path.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)
67
+ @request.path_info
69
68
  end
70
69
 
71
70
  def request
@@ -93,5 +92,11 @@ module GoSso
93
92
  def fail!(hash)
94
93
  [200, { 'Content-Type' => 'application/json' }, [hash.to_json]]
95
94
  end
95
+
96
+ private
97
+ def path_with_script_name(_path)
98
+ path = request.script_name.to_s.chomp("/")
99
+ path << _path if _path.present?
100
+ end
96
101
  end
97
102
  end
@@ -1,3 +1,3 @@
1
1
  module GoSso
2
- VERSION = '0.4.2'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_sso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Feng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-26 00:00:00.000000000 Z
11
+ date: 2023-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.1.2
156
+ rubygems_version: 3.3.7
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Summary of GoSso.