hubssolib 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +10 -3
- data/hubssolib.gemspec +1 -1
- data/lib/hub_sso_lib.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b434d369e25dc81a74c87385df70cade7dfd40c47abfae2c05732b471b6e1f5e
|
4
|
+
data.tar.gz: 41d2303f125f52a5f957f851f1a8d5ae7067ab8233fcfa5359640f88e3bceb06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc3e04c0b1e75eecf504c61d19834151179666b7e601d974cbf74509f1ab1197bbf74cf347c63b4e1aef61d744bceb96621b7fccb8017654f6d4266eea21246
|
7
|
+
data.tar.gz: ba3e8e1985dd91185c6049e25212dcade4dfe064faf31c4e1c1d013ac8851984f3b48ee47df5de16d097863ea36c9165c93790e05703f8fa640908e7260c3b4b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 3.3.0, 16-Feb-2025
|
2
|
+
|
3
|
+
Sentry support, for use by the DRb server. If you use Sentry, define your account's `SENTRY_DSN` in the environment where the DRb server runs and exceptions will be reported.
|
4
|
+
|
5
|
+
## 3.2.1, 16-Feb-2025
|
6
|
+
|
7
|
+
The conditional login return-via-referrer mechanism never really worked, so instead have the login status indicator link generate a return-to URL in the query string instead and forward that, if present, in preference.
|
8
|
+
|
1
9
|
## 3.2.0, 15-Feb-2025
|
2
10
|
|
3
11
|
Introduces the user change handler mechanism, a scheme whereby an external application tells Hub about a Rake task that the application has implemented, through which Hub can inform if of changes to a user's e-mail address or "real" name. See the gem's `README.md` for details, under "Applications with an existing user model".
|
data/README.md
CHANGED
@@ -166,7 +166,7 @@ To solve these problems, external applications integrated with Hub can participa
|
|
166
166
|
```ruby
|
167
167
|
module Foo
|
168
168
|
class Application < Rails::Application
|
169
|
-
|
169
|
+
include HubSsoLib::Core
|
170
170
|
|
171
171
|
hubssolib_register_user_change_handler(
|
172
172
|
app_name: Rails.application.name,
|
@@ -187,12 +187,19 @@ For example, `lib/tasks/hub.rake` might look like this:
|
|
187
187
|
namespace :hub do
|
188
188
|
desc 'Update a user with details sent from Hub'
|
189
189
|
task :update_user, [:old_email, :old_name, :new_email, :new_name] => :environment do | t, args |
|
190
|
-
user = User.find_by_email_address(old_email)
|
191
|
-
|
190
|
+
user = User.find_by_email_address(args[:old_email])
|
191
|
+
|
192
|
+
# ...or use "user&.update_columns" for speed and to bypass validations, as
|
193
|
+
# Hub's validations may not be as strict as yours but it doesn't matter if
|
194
|
+
# you're happy syncing Hub data in general.
|
195
|
+
#
|
196
|
+
user&.update!(email_address: args[:new_email], display_name: args[:new_name])
|
192
197
|
end
|
193
198
|
end
|
194
199
|
```
|
195
200
|
|
201
|
+
The four arguments are guaranteed to be present and non-empty, with leading or trailing white space already stripped. You don't need to waste time checking for `nil` or blank values. The upper/lower case **is preserved**, as entered by the user, for all arguments - so e-mail addresses in particular might contain a mixture of upper and lower case letters. If this matters to your application, be sure to apply whatever normalisation you previously used when your user record was originally created with the old Hub-sourced e-mail and/or name.
|
202
|
+
|
196
203
|
|
197
204
|
|
198
205
|
## Hub library API
|
data/hubssolib.gemspec
CHANGED
data/lib/hub_sso_lib.rb
CHANGED
@@ -412,6 +412,10 @@ module HubSsoLib
|
|
412
412
|
@session_user = HubSsoLib::User.new
|
413
413
|
@session_key_rotation = nil
|
414
414
|
@session_ip = nil
|
415
|
+
|
416
|
+
rescue => e
|
417
|
+
Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
|
418
|
+
raise
|
415
419
|
end
|
416
420
|
end # Session class
|
417
421
|
|
@@ -433,6 +437,10 @@ module HubSsoLib
|
|
433
437
|
@hub_sessions = {}
|
434
438
|
|
435
439
|
puts "Session factory: Awaken" unless @hub_be_quiet
|
440
|
+
|
441
|
+
rescue => e
|
442
|
+
Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
|
443
|
+
raise
|
436
444
|
end
|
437
445
|
|
438
446
|
# Get a session using a given key (a UUID). Generates a new session if
|
@@ -481,10 +489,18 @@ module HubSsoLib
|
|
481
489
|
|
482
490
|
hub_session.session_key_rotation = new_key
|
483
491
|
return hub_session
|
492
|
+
|
493
|
+
rescue => e
|
494
|
+
Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
|
495
|
+
raise
|
484
496
|
end
|
485
497
|
|
486
498
|
def enumerate_hub_sessions()
|
487
499
|
@hub_sessions
|
500
|
+
|
501
|
+
rescue => e
|
502
|
+
Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
|
503
|
+
raise
|
488
504
|
end
|
489
505
|
end
|
490
506
|
|
@@ -511,6 +527,10 @@ module HubSsoLib
|
|
511
527
|
@@hub_session_factory = HubSsoLib::SessionFactory.new
|
512
528
|
DRb.start_service(HUB_CONNECTION_URI, @@hub_session_factory, { :safe_level => 1 })
|
513
529
|
DRb.thread.join
|
530
|
+
|
531
|
+
rescue => e
|
532
|
+
Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
|
533
|
+
raise
|
514
534
|
end
|
515
535
|
end # Server module
|
516
536
|
|
@@ -555,6 +575,15 @@ module HubSsoLib
|
|
555
575
|
noscript_img_src = "#{HUB_PATH_PREFIX}/account/login_indication.png"
|
556
576
|
noscript_img_tag = helpers.image_tag(noscript_img_src, size: '90x22', border: '0', alt: 'Log in or out')
|
557
577
|
|
578
|
+
if self.respond_to?(:request)
|
579
|
+
return_to_url = self.request.try(:original_url)
|
580
|
+
|
581
|
+
if return_to_url.present?
|
582
|
+
return_query = URI.encode_www_form({ return_to_url: return_to_url.to_s })
|
583
|
+
ui_href << "?#{return_query}"
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
558
587
|
logged_in_link = helpers.link_to('Account', ui_href, id: 'hubssolib_logged_in_link')
|
559
588
|
logged_out_link = helpers.link_to('Log in', ui_href, id: 'hubssolib_logged_out_link')
|
560
589
|
noscript_link = helpers.link_to(noscript_img_tag, ui_href, id: 'hubssolib_login_noscript')
|
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.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hodgkinson and others
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: drb
|