go_sso 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 155cd585d52719cff9b8a3fbed42c64fd2cc0063186ba11bb840a584fd346fb9
4
- data.tar.gz: a935bd3d46dfe1b2ecbeac71638ebd545eccb88757b965fb4d273276a948696d
3
+ metadata.gz: 904cedd809a2f4bb6f9ddc5ab11b8ed3cae039228ab577d69179141b0cdaf1e5
4
+ data.tar.gz: 1f5e0e051a65b642a2cd67451fed20331addafd217f9743811fc737128debb13
5
5
  SHA512:
6
- metadata.gz: acd883edfc6190905d84f311efb3ab1f0be7878ec7016cc377fff1807eea9898284b87bf5f9d03c8d78bec21513113f466a1be2d3946eec8a0fb54fa86b297f5
7
- data.tar.gz: ea51cac736405682d09b0c9bf9ff0e9f5eb99b509c40c48717bb579401950178d710e992f5c72f64fd775e0745c7e480df7da7315426fb809ba93d33a98c93d1
6
+ metadata.gz: '079edece6cd52dc37af2f776c93dcbf25f98c33761d05b1b9aaa5fe2157257fbfb8a5680d0eb335208a643f69a1db9a7c6dd0f038cd44ac4e8b3c7eb075ab644'
7
+ data.tar.gz: b19abc01a2637483138f1c11d420eb34f004118e9494b45dff14b173c16dda5ecb0c9a02e989eb3de80cea6936dbaf287484e3bb6ef61f0d891df5a56104ddd2
@@ -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.3'
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.3
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: 2022-05-16 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.