hubssolib 3.8.1 → 4.0.1

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: 5fea64186dc1f80987fb5b531c46ac8eb9fff78878520b38e392a91dad8de7a9
4
- data.tar.gz: 2ebe2f6599cbd9bf9dbfbaa6ebbbb81e99fe6f4922c5f8c19e250e380222c3c9
3
+ metadata.gz: b1c0cc452aa9f993bae6898c2b2096df8a331fc9994150342a145635ccf37c75
4
+ data.tar.gz: d5e3012bd64bb3baed92ecf46115f0ed39e4c1df5cf86981f455f8aa361781a0
5
5
  SHA512:
6
- metadata.gz: 44b066f10c3615a752b258d85ccf5316358c33af6589c9702ab6b2ae8036f6e7eda9f99ab2a2707dc9acce9e9377ce5e73f28c3533eaec7c7312ac5e6e828fe3
7
- data.tar.gz: 1f7ae4d9e29916eb3d14e3c057b61f95192be76954270fd8570dd596a5552495561df2bddd1f16f887ac613bbcd3292fd75228f4bbddf87faeda698c2a866067
6
+ metadata.gz: 97735fe3f0a68c0cf4bc07b6b0ed2d7d7f36a41d2c2b7a45b889fbca6e008aa2af44b54f632b8860b41ee2774dd1d6d632c48710e29b14e2bfd0dbb613d1dd3a
7
+ data.tar.gz: 6b0c0aa270b61701fc9fbac4d0e984a5770e0fde58685ec4a16e91cdf40e415a7924246cee023dc17a4e4d9f7bfc9f340aa1d264b2fa573886eeaed86e8632e2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 4.0.0 and 4.0.1, 24-Jul-2026
2
+
3
+ * Despite the major version bump, this is a maintenance release for client apps. Integration for all Hub features including the Hub Trust mechanism is unchanged.
4
+ * If you do not use Hub Trust features at all, then this is also only a maintenance release for the Hub app itself and nothing more is needed to run the entire Hub assembly.
5
+ * If you do use Hub Trust features, then note that the way in which you launch the Trust Server, which previously auto-launched with the Hub app but was prone to being killed or otherwise terminating without warning, has changed. In a manner similar to the separately-launched and reliable Session server, the Trust server must be separately launched. This is done with a Rake task so that the Trust server has full access to the Hub app environment.
6
+
7
+ 4.0.1 just updated Gemspec metadata without any other changes - I didn't realise you couldn't yank & republish the same version anymore in RubyGems, so was forced to bump the patch version.
8
+
9
+ ## 3.8.2, 17-May-2025
10
+
11
+ * General maintenance update.
12
+
1
13
  ## 3.8.1, 09-Apr-2025
2
14
 
3
15
  * It's been too long since I worked with DRb! Important fix for "live" (undumpable) vs copied objects which could lead to session enumeration problems in clients. Now, sessions enumerated by user ID are copies as is user data returned by HubSsoLib::Core#hubssolib_enumerate_users.
data/Gemfile.lock CHANGED
@@ -1,36 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubssolib (3.8.1)
4
+ hubssolib (4.0.0)
5
5
  base64 (~> 0.2)
6
6
  drb (~> 2.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (8.0.2)
12
- actionpack (= 8.0.2)
13
- activesupport (= 8.0.2)
11
+ action_text-trix (2.1.19)
12
+ railties
13
+ actioncable (8.1.3)
14
+ actionpack (= 8.1.3)
15
+ activesupport (= 8.1.3)
14
16
  nio4r (~> 2.0)
15
17
  websocket-driver (>= 0.6.1)
16
18
  zeitwerk (~> 2.6)
17
- actionmailbox (8.0.2)
18
- actionpack (= 8.0.2)
19
- activejob (= 8.0.2)
20
- activerecord (= 8.0.2)
21
- activestorage (= 8.0.2)
22
- activesupport (= 8.0.2)
19
+ actionmailbox (8.1.3)
20
+ actionpack (= 8.1.3)
21
+ activejob (= 8.1.3)
22
+ activerecord (= 8.1.3)
23
+ activestorage (= 8.1.3)
24
+ activesupport (= 8.1.3)
23
25
  mail (>= 2.8.0)
24
- actionmailer (8.0.2)
25
- actionpack (= 8.0.2)
26
- actionview (= 8.0.2)
27
- activejob (= 8.0.2)
28
- activesupport (= 8.0.2)
26
+ actionmailer (8.1.3)
27
+ actionpack (= 8.1.3)
28
+ actionview (= 8.1.3)
29
+ activejob (= 8.1.3)
30
+ activesupport (= 8.1.3)
29
31
  mail (>= 2.8.0)
30
32
  rails-dom-testing (~> 2.2)
31
- actionpack (8.0.2)
32
- actionview (= 8.0.2)
33
- activesupport (= 8.0.2)
33
+ actionpack (8.1.3)
34
+ actionview (= 8.1.3)
35
+ activesupport (= 8.1.3)
34
36
  nokogiri (>= 1.8.5)
35
37
  rack (>= 2.2.4)
36
38
  rack-session (>= 1.0.1)
@@ -38,87 +40,93 @@ GEM
38
40
  rails-dom-testing (~> 2.2)
39
41
  rails-html-sanitizer (~> 1.6)
40
42
  useragent (~> 0.16)
41
- actiontext (8.0.2)
42
- actionpack (= 8.0.2)
43
- activerecord (= 8.0.2)
44
- activestorage (= 8.0.2)
45
- activesupport (= 8.0.2)
43
+ actiontext (8.1.3)
44
+ action_text-trix (~> 2.1.15)
45
+ actionpack (= 8.1.3)
46
+ activerecord (= 8.1.3)
47
+ activestorage (= 8.1.3)
48
+ activesupport (= 8.1.3)
46
49
  globalid (>= 0.6.0)
47
50
  nokogiri (>= 1.8.5)
48
- actionview (8.0.2)
49
- activesupport (= 8.0.2)
51
+ actionview (8.1.3)
52
+ activesupport (= 8.1.3)
50
53
  builder (~> 3.1)
51
54
  erubi (~> 1.11)
52
55
  rails-dom-testing (~> 2.2)
53
56
  rails-html-sanitizer (~> 1.6)
54
- activejob (8.0.2)
55
- activesupport (= 8.0.2)
57
+ activejob (8.1.3)
58
+ activesupport (= 8.1.3)
56
59
  globalid (>= 0.3.6)
57
- activemodel (8.0.2)
58
- activesupport (= 8.0.2)
59
- activerecord (8.0.2)
60
- activemodel (= 8.0.2)
61
- activesupport (= 8.0.2)
60
+ activemodel (8.1.3)
61
+ activesupport (= 8.1.3)
62
+ activerecord (8.1.3)
63
+ activemodel (= 8.1.3)
64
+ activesupport (= 8.1.3)
62
65
  timeout (>= 0.4.0)
63
- activestorage (8.0.2)
64
- actionpack (= 8.0.2)
65
- activejob (= 8.0.2)
66
- activerecord (= 8.0.2)
67
- activesupport (= 8.0.2)
66
+ activestorage (8.1.3)
67
+ actionpack (= 8.1.3)
68
+ activejob (= 8.1.3)
69
+ activerecord (= 8.1.3)
70
+ activesupport (= 8.1.3)
68
71
  marcel (~> 1.0)
69
- activesupport (8.0.2)
72
+ activesupport (8.1.3)
70
73
  base64
71
- benchmark (>= 0.3)
72
74
  bigdecimal
73
75
  concurrent-ruby (~> 1.0, >= 1.3.1)
74
76
  connection_pool (>= 2.2.5)
75
77
  drb
76
78
  i18n (>= 1.6, < 2)
79
+ json
77
80
  logger (>= 1.4.2)
78
81
  minitest (>= 5.1)
79
82
  securerandom (>= 0.3)
80
83
  tzinfo (~> 2.0, >= 2.0.5)
81
84
  uri (>= 0.13.1)
82
- base64 (0.2.0)
83
- benchmark (0.4.0)
84
- bigdecimal (3.1.9)
85
+ base64 (0.3.0)
86
+ bigdecimal (4.1.2)
85
87
  builder (3.3.0)
86
- concurrent-ruby (1.3.5)
87
- connection_pool (2.5.0)
88
- crass (1.0.6)
89
- date (3.4.1)
90
- debug (1.10.0)
88
+ concurrent-ruby (1.3.8)
89
+ connection_pool (3.0.2)
90
+ crass (1.0.7)
91
+ date (3.5.1)
92
+ debug (1.11.1)
91
93
  irb (~> 1.10)
92
94
  reline (>= 0.3.8)
93
- diff-lcs (1.6.1)
95
+ diff-lcs (1.6.2)
94
96
  docile (1.4.1)
95
97
  doggo (1.4.0)
96
98
  rspec-core (~> 3.13)
97
- drb (2.2.1)
99
+ drb (2.2.3)
100
+ erb (6.0.6)
98
101
  erubi (1.13.1)
99
- globalid (1.2.1)
102
+ globalid (1.4.0)
100
103
  activesupport (>= 6.1)
101
- i18n (1.14.7)
104
+ i18n (1.15.2)
102
105
  concurrent-ruby (~> 1.0)
103
- io-console (0.8.0)
104
- irb (1.15.2)
106
+ io-console (0.8.2)
107
+ irb (1.18.0)
105
108
  pp (>= 0.6.0)
109
+ prism (>= 1.3.0)
106
110
  rdoc (>= 4.0.0)
107
111
  reline (>= 0.4.2)
112
+ json (2.21.1)
108
113
  logger (1.7.0)
109
- loofah (2.24.0)
114
+ loofah (2.25.2)
110
115
  crass (~> 1.0.2)
111
116
  nokogiri (>= 1.12.0)
112
- mail (2.8.1)
117
+ mail (2.9.1)
118
+ logger
113
119
  mini_mime (>= 0.1.1)
114
120
  net-imap
115
121
  net-pop
116
122
  net-smtp
117
- marcel (1.0.4)
123
+ marcel (1.2.1)
118
124
  mini_mime (1.1.5)
119
- mini_portile2 (2.8.8)
120
- minitest (5.25.5)
121
- net-imap (0.5.6)
125
+ mini_portile2 (2.8.9)
126
+ minitest (6.0.6)
127
+ drb (~> 2.0)
128
+ prism (~> 1.5)
129
+ net-imap (0.6.6)
122
130
  date
123
131
  net-protocol
124
132
  net-pop (0.1.2)
@@ -127,91 +135,97 @@ GEM
127
135
  timeout
128
136
  net-smtp (0.5.1)
129
137
  net-protocol
130
- nio4r (2.7.4)
131
- nokogiri (1.18.7)
138
+ nio4r (2.7.5)
139
+ nokogiri (1.19.4)
132
140
  mini_portile2 (~> 2.8.2)
133
141
  racc (~> 1.4)
134
- pp (0.6.2)
142
+ pp (0.6.4)
135
143
  prettyprint
136
144
  prettyprint (0.2.0)
137
- psych (5.2.3)
138
- date
139
- stringio
145
+ prism (1.9.0)
140
146
  racc (1.8.1)
141
- rack (3.1.12)
142
- rack-session (2.1.0)
147
+ rack (3.2.6)
148
+ rack-session (2.1.2)
143
149
  base64 (>= 0.1.0)
144
150
  rack (>= 3.0.0)
145
151
  rack-test (2.2.0)
146
152
  rack (>= 1.3)
147
- rackup (2.2.1)
153
+ rackup (2.3.1)
148
154
  rack (>= 3)
149
- rails (8.0.2)
150
- actioncable (= 8.0.2)
151
- actionmailbox (= 8.0.2)
152
- actionmailer (= 8.0.2)
153
- actionpack (= 8.0.2)
154
- actiontext (= 8.0.2)
155
- actionview (= 8.0.2)
156
- activejob (= 8.0.2)
157
- activemodel (= 8.0.2)
158
- activerecord (= 8.0.2)
159
- activestorage (= 8.0.2)
160
- activesupport (= 8.0.2)
155
+ rails (8.1.3)
156
+ actioncable (= 8.1.3)
157
+ actionmailbox (= 8.1.3)
158
+ actionmailer (= 8.1.3)
159
+ actionpack (= 8.1.3)
160
+ actiontext (= 8.1.3)
161
+ actionview (= 8.1.3)
162
+ activejob (= 8.1.3)
163
+ activemodel (= 8.1.3)
164
+ activerecord (= 8.1.3)
165
+ activestorage (= 8.1.3)
166
+ activesupport (= 8.1.3)
161
167
  bundler (>= 1.15.0)
162
- railties (= 8.0.2)
163
- rails-dom-testing (2.2.0)
168
+ railties (= 8.1.3)
169
+ rails-dom-testing (2.3.0)
164
170
  activesupport (>= 5.0.0)
165
171
  minitest
166
172
  nokogiri (>= 1.6)
167
- rails-html-sanitizer (1.6.2)
168
- loofah (~> 2.21)
173
+ rails-html-sanitizer (1.7.1)
174
+ loofah (~> 2.25, >= 2.25.2)
169
175
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
170
- railties (8.0.2)
171
- actionpack (= 8.0.2)
172
- activesupport (= 8.0.2)
176
+ railties (8.1.3)
177
+ actionpack (= 8.1.3)
178
+ activesupport (= 8.1.3)
173
179
  irb (~> 1.13)
174
180
  rackup (>= 1.0.0)
175
181
  rake (>= 12.2)
176
182
  thor (~> 1.0, >= 1.2.2)
183
+ tsort (>= 0.2)
177
184
  zeitwerk (~> 2.6)
178
- rake (13.2.1)
179
- rdoc (6.13.1)
180
- psych (>= 4.0.0)
181
- reline (0.6.1)
185
+ rake (13.4.2)
186
+ rbs (4.0.3)
187
+ logger
188
+ prism (>= 1.6.0)
189
+ tsort
190
+ rdoc (8.0.0)
191
+ erb
192
+ prism (>= 1.6.0)
193
+ rbs (>= 4.0.0)
194
+ tsort
195
+ reline (0.6.3)
182
196
  io-console (~> 0.5)
183
- rspec (3.13.0)
197
+ rspec (3.13.2)
184
198
  rspec-core (~> 3.13.0)
185
199
  rspec-expectations (~> 3.13.0)
186
200
  rspec-mocks (~> 3.13.0)
187
- rspec-core (3.13.3)
201
+ rspec-core (3.13.6)
188
202
  rspec-support (~> 3.13.0)
189
- rspec-expectations (3.13.3)
203
+ rspec-expectations (3.13.5)
190
204
  diff-lcs (>= 1.2.0, < 2.0)
191
205
  rspec-support (~> 3.13.0)
192
- rspec-mocks (3.13.2)
206
+ rspec-mocks (3.13.8)
193
207
  diff-lcs (>= 1.2.0, < 2.0)
194
208
  rspec-support (~> 3.13.0)
195
- rspec-support (3.13.2)
209
+ rspec-support (3.13.7)
196
210
  securerandom (0.4.1)
197
211
  simplecov (0.22.0)
198
212
  docile (~> 1.1)
199
213
  simplecov-html (~> 0.11)
200
214
  simplecov_json_formatter (~> 0.1)
201
- simplecov-html (0.13.1)
215
+ simplecov-html (0.13.2)
202
216
  simplecov_json_formatter (0.1.4)
203
- stringio (3.1.6)
204
- thor (1.3.2)
205
- timeout (0.4.3)
217
+ thor (1.5.0)
218
+ timeout (0.6.1)
219
+ tsort (0.2.0)
206
220
  tzinfo (2.0.6)
207
221
  concurrent-ruby (~> 1.0)
208
- uri (1.0.3)
222
+ uri (1.1.1)
209
223
  useragent (0.16.11)
210
- websocket-driver (0.7.7)
224
+ websocket-driver (0.8.2)
211
225
  base64
212
226
  websocket-extensions (>= 0.1.0)
213
227
  websocket-extensions (0.1.5)
214
- zeitwerk (2.7.2)
228
+ zeitwerk (2.8.2)
215
229
 
216
230
  PLATFORMS
217
231
  ruby
@@ -226,4 +240,4 @@ DEPENDENCIES
226
240
  simplecov (~> 0.22)
227
241
 
228
242
  BUNDLED WITH
229
- 2.6.2
243
+ 4.0.10
data/README.md CHANGED
@@ -30,18 +30,17 @@ Include in a project by adding this to your `Gemfile`:
30
30
  gem 'hubssolib', '~> 3.0', require: 'hub_sso_lib'
31
31
  ```
32
32
 
33
- ### The DRb server
33
+ ### The DRb Session Server
34
34
 
35
- The Hub DRb server consists of a small wrapper Ruby script which does most of its work using the Hub gem. To run the server, you need to first specify a DRb connection URI in the `HUB_CONNECTION_URI` environment variable. Usually, this is a Unix domain socket and so lives in a location of your choice in the local filesystem. Run the server by running `ruby` on the `hub_sso_server.rb` file in the Hub archive. For example:
35
+ The Hub DRb Session Server consists of a small wrapper Ruby script which does most of its work using the Hub gem. The server needs to know the DRb connection URI that works for your system. A Unix-domain socket using a socket file `~/.hub_drb` is chosen as the default, but can override this with the `HUB_CONNECTION_URI` environment variable. If you specify a custom URI, note that it _MUST_ start with `drbunix:`; the Session Server must not be run on an IP port for security reasons.
36
+
37
+ The server Ruby script has its own `Gemfile`, so after a `bundle install` inside the folder where `hub_sso_server.rb` lives, run with something like this:
36
38
 
37
39
  ```sh
38
- HUB_CONNECTION_URI="drbunix:/home/username/sockets/.hub_drb"
39
- export HUB_CONNECTION_URI
40
- ruby /home/username/hubssolib/hub_sso_server.rb &
40
+ HUB_CONNECTION_URI="drbunix:/home/username/sockets/.hub_drb" \
41
+ bundle exec ruby /home/username/hubssolib/server/hub_sso_server.rb &
41
42
  ```
42
43
 
43
- The default is to use a file `.hub_drb` in the root of the current user's home directory. If you specify a custom URI, note that it _MUST_ start with `drbunix:`; the hub server must not be run on an IP port for security reasons.
44
-
45
44
  ### The Hub application
46
45
 
47
46
  Finally you can install the Hub application using whatever mechanism you prefer to application installation. See ample documentation elsewhere on the Web for information on installing Ruby On Rails applications — Hub itself contains the default rails README file with quite a lot of information in it.
@@ -462,7 +461,7 @@ The payload items shown above are both mandatory:
462
461
 
463
462
  If either item is missing or blank, or if for any reason Hub finds itself unable to associated the action with a user record on Hub's side, then no e-mail message will be sent.
464
463
 
465
- **IMPORTANT:** The Hub application's database migration at the time you updated to 3.7.0 will have set existing users to trusted for historic data, but new users are untrusted. If you introduce trust integration to your site's other apps after this, you might want to enter the console to update any new users added since likewise; inside `app/hub`, issue:
464
+ **OPTIONAL DATA MIGRATION:** The Hub application's database migration at the time you updated to 3.7.0 will have set existing users to trusted for historic data, but new users are untrusted. If you introduce trust integration to your site's other apps after this, you might want to enter the console to update any new users added since likewise; inside `app/hub`, issue:
466
465
 
467
466
  ```
468
467
  $ bundle exec rails c
@@ -471,3 +470,25 @@ $ bundle exec rails c
471
470
  ```
472
471
 
473
472
  The trust mechanism involves a fair amount of effort on the integrating app's side but it can be very useful if you have a site where, despite your best efforts, sometimes spam/bot accounts manage to get inside and try to flood the system with spam. It's just one of many different potential protection and mitigation mechanisms that your site might choose to employ.
473
+
474
+ ### The DRb Trust Server
475
+
476
+ In a similar fashion to the DRb Session Server, there is a Trust Server which must be launched so that applications using the mechanism describe above have something to "talk" to (with the underlying mechanics taken care of by the Hub gem). In Hub v3, this was managed by the Hub app itself but process management and lifecycles can be complex in a Rails app and the approach was unreliable. Since Hub v4 there is a much more reliable, separately-launched command, just like with the Session Server.
477
+
478
+ Untrusted action data is stored in the Hub app database and the Hub app will send notification e-mails out to moderators for each untrusted action event, so the DRb Trust Server is run via a Rake task that's part of the Hub app and uses its configured environment. The same environment variables that you pass to launch the Hub application should therefore be passed to the Rake task. As a bare minimum, make sure that `HUB_PATH_PREFIX` is set to the full URL needed to access the root path of the Hub application's web interface, as this is used when generating URLs in notification e-mails.
479
+
480
+ The default location of the Unix-domain DRb server socket is `~/.hub_trust_drb` but you can override it with `HUB_TRUST_CONNECTION_URI`. As with the Session Server, if you specify a custom URI, note that it _MUST_ start with `drbunix:`; the Trust Server must not be run on an IP port for security reasons.
481
+
482
+ ```sh
483
+ HUB_TRUST_CONNECTION_URI="drbunix:/home/username/sockets/.hub_trust_drb" \
484
+ HUB_PATH_PREFIX="https://www.example.com/hub" \
485
+ bundle exec bin/rails hub_trust:server &
486
+ ```
487
+
488
+ You can silence `$stdout` with `HUB_QUIET_SERVER=yes`, or if wishing to instead capture output to log files, the Rails `log` folder is a good place to put them:
489
+
490
+ ```sh
491
+ HUB_TRUST_CONNECTION_URI="drbunix:/home/username/sockets/.hub_trust_drb" \
492
+ HUB_PATH_PREFIX="https://www.example.com/hub" \
493
+ bundle exec bin/rails hub_trust:server 1>> "log/trust_server_stdout.log" 2>> "logs/trust_server_stderr.log" &
494
+ ```
Binary file
data/hubssolib.gemspec CHANGED
@@ -4,13 +4,15 @@ spec = Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = 'hubssolib'
6
6
 
7
- s.version = '3.8.1'
7
+ s.version = '4.0.1'
8
8
  s.author = 'Andrew Hodgkinson and others'
9
9
  s.email = 'ahodgkin@rowing.org.uk'
10
10
  s.homepage = 'http://pond.org.uk/'
11
11
  s.summary = 'Cross-application single sign-on support library.'
12
12
  s.license = 'MIT'
13
13
 
14
+ s.metadata["source_code_uri"] = "https://gitlab.riscosopen.org/website/hubssolib"
15
+
14
16
  s.description = <<-EOF
15
17
  The Hub SSO Library supports single sign-on across multiple Rails
16
18
  applications on the same host. The Hub application provides account
data/lib/hub_sso_lib.rb CHANGED
@@ -918,52 +918,65 @@ module HubSsoLib
918
918
  HUB_TRUST_CONNECTION_URI
919
919
  end
920
920
 
921
- # Start the trust server. This should only ever be called by the Hub Rails
922
- # application, which implements HubSsoLib::Trust::Server.
921
+ # Is the server already running?
923
922
  #
924
- def self.launch_server
925
- uri = self.get_trust_server_connection_uri()
926
- path = URI.parse(uri).path
927
- already_running = File.exist?(path)
923
+ def self.already_running?
924
+ uri = self.get_trust_server_connection_uri()
925
+ path = URI.parse(uri).path
928
926
 
929
- unless ENV['HUB_QUIET_SERVER'] == 'yes'
930
- message = unless already_running
931
- "Trust server: Starting at #{ uri }"
932
- else
933
- "Trust server: Already running at at #{ uri }"
934
- end
927
+ return File.exist?(path)
928
+ end
935
929
 
936
- puts message
930
+ module Server
931
+ def hubssolib_launch_trust_server
932
+ ::HubSsoLib::Trust::Server::Runner.run
937
933
  end
938
934
 
939
- unless already_running
940
- loop do
941
- DRb.start_service(uri, ::HubSsoLib::Trust::Server.new)
942
- DRb.thread.join # Keep the thread alive...
943
- end # ...but auto-restart if e.g. DRb.stop_service() is invoked
944
- end
945
- end
935
+ class Runner
936
+ QUEUE = ::Queue.new
946
937
 
947
- # Obtain a connection to the trust server. This is called by any client
948
- # code that needs to talk to the server which must, at the time called, be
949
- # running via startup within the Hub Rails application.
950
- #
951
- # The returned object is an instance of ::HubSsoLib::Trust::Server, which
952
- # is defined inside the Hub Rails application. See there for details.
953
- #
954
- def self.get_trust_object
955
- HUB_MUTEX.synchronize do
956
- begin
957
- DRb.current_server
958
- rescue DRb::DRbServerNotFound
959
- DRb.start_service()
938
+ def self.run
939
+ uri = ::HubSsoLib::Trust.get_trust_server_connection_uri()
940
+ already_running = ::HubSsoLib::Trust.already_running?
941
+
942
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
943
+ message = unless already_running
944
+ "Trust server: Starting at #{ uri }"
945
+ else
946
+ "Trust server: Already running at at #{ uri }"
947
+ end
948
+
949
+ puts message
950
+ end
951
+
952
+ Signal.trap('INT' ) { QUEUE << :INT }
953
+ Signal.trap('TERM') { QUEUE << :TERM }
954
+
955
+ DRb.start_service(uri, ::HubApp::Trust::ActionManager.new, { :safe_level => 1 })
956
+
957
+ QUEUE.pop
958
+
959
+ self.shutdown()
960
+ exit
961
+
962
+ rescue => e
963
+ Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
964
+ raise
960
965
  end
961
966
 
962
- @@trust_object ||= DRbObject.new_with_uri(self.get_trust_server_connection_uri())
963
- end
967
+ def self.shutdown
968
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
969
+ puts "Server: Graceful shutdown..."
970
+ end
964
971
 
965
- return @@trust_object
966
- end
972
+ DRb.stop_service
973
+
974
+ unless ENV['HUB_QUIET_SERVER'] == 'yes'
975
+ puts "Server: ...completed."
976
+ end
977
+ end
978
+ end # Runner class
979
+ end # Server module
967
980
  end
968
981
 
969
982
  #######################################################################
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubssolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hodgkinson and others
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: drb
@@ -138,13 +138,14 @@ files:
138
138
  - Gemfile
139
139
  - Gemfile.lock
140
140
  - README.md
141
- - hubssolib-3.7.0.gem
141
+ - hubssolib-4.0.0.gem
142
142
  - hubssolib.gemspec
143
143
  - lib/hub_sso_lib.rb
144
144
  homepage: http://pond.org.uk/
145
145
  licenses:
146
146
  - MIT
147
- metadata: {}
147
+ metadata:
148
+ source_code_uri: https://gitlab.riscosopen.org/website/hubssolib
148
149
  rdoc_options: []
149
150
  require_paths:
150
151
  - lib
@@ -159,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0'
161
162
  requirements: []
162
- rubygems_version: 3.6.2
163
+ rubygems_version: 4.0.16
163
164
  specification_version: 4
164
165
  summary: Cross-application single sign-on support library.
165
166
  test_files: []
data/hubssolib-3.7.0.gem DELETED
Binary file