hubssolib 2.1.0 → 3.0.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: 5fafbf54747841c2d90eaa755481e8c1eecf9e060d64e62d7ff6a446acf2bbc4
4
- data.tar.gz: 2243d8561879026aedc904f6505e3a38e2193db7ed5d94540bc520976e15ef23
3
+ metadata.gz: f418c1a21497375e396be12fd95387b6a436ed42c8145dc681ee041eded447a3
4
+ data.tar.gz: 06d7868acf059c7c9df758d960b508e6e063fb0f1b012ff520a549772079a486
5
5
  SHA512:
6
- metadata.gz: a3653217e5809704a69b20fcae5f94a3066ed26085fdced81c36c8f8bf99b9299212ddf51fde2af411790dd51ebcbd004fe4993c61c0a6588e39f8b080a6abce
7
- data.tar.gz: 437fa627ad45ae7baa8e9772a3c1157db324d7b62d889fb53eb81b395317b985b02a5d04ee1f4e7cd1111de3ca24ed16376913ad0b5328b4e630ff241167d793
6
+ metadata.gz: fa015b2a0853402ee85b23c788bfd52a15cbda02c000ad0c6f6eba882e664393fe7927119f2b53c2f396d9b8f6d9337b85bdfa5fe50866e07a9fe7942b8700cf
7
+ data.tar.gz: 006b768e21fe802806c946062b0e74be65cad124833f861455f09f684887c09104f281450b08295bf9c17f472e1839c291b6f6422212cbf9717d03d8925ba3c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 3.0.0, 28-Jan-2025
2
+
3
+ * The Hub "login indication" URL approach is now dropped, so layout templates **must be updated.**
4
+
5
+ In Hub v1 and v2, login indication was done via an image that was served by the Hub application itself, wrapped in a link that visited a "conditional login" endpoint which stored the return-to URL, ensured HTTPS was in use and visited either the log in, or log out page as required. In client applications it looked a bit like this:
6
+
7
+ ```html
8
+ <a class="img" href="<%= ENV['HUB_PATH_PREFIX'] %>/account/login_conditional">
9
+ <img src="<%= ENV['HUB_PATH_PREFIX'] %>/account/login_indication" alt="Account" height="22" width="90" />
10
+ </a>
11
+ ```
12
+
13
+ This dates back to a time when CSS support was not that widespread and RISC OS Open needed the web site to work well on web browsers available at the time. Things have improved enormously since then, so now a cleaner, pure CSS solution is used. This has the enormous advantage of requiring no image fetch request-response into the Hub application. Just use:
14
+
15
+ ```ruby
16
+ <%= hubssolib_account_link() %>
17
+ ```
18
+
19
+ ...in place of the markup above.
20
+
21
+
22
+
1
23
  ## 2.1.0, 01-Jul-2022
2
24
 
3
25
  * Use `HUB_QUIET_SERVER=yes ...` to quieten `$stdout` output from Hub server.
@@ -5,6 +27,8 @@
5
27
  * Maintenance `bundle update`.
6
28
  * A few minor tidy-ups in the implementation.
7
29
 
30
+
31
+
8
32
  ## Version 1.0.0 -> Version 2.0.0, 19-Apr-2020
9
33
 
10
34
  The public interface to applications is generally unchanged, but the cookie storage mechanism has been improved and is not compatible with v1 of Hub. You will need to use the newer Hub application, server and gem, but hopefully will find you don't need to change anything with your integrated applications.
data/Gemfile.lock CHANGED
@@ -1,46 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubssolib (2.1.0)
4
+ hubssolib (3.0.0)
5
+ base64 (~> 0.2)
6
+ drb (~> 2.2)
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
8
10
  specs:
9
- byebug (11.1.3)
10
- diff-lcs (1.5.0)
11
- docile (1.4.0)
12
- doggo (1.2.0)
13
- rspec-core (~> 3.10)
14
- rspec (3.11.0)
15
- rspec-core (~> 3.11.0)
16
- rspec-expectations (~> 3.11.0)
17
- rspec-mocks (~> 3.11.0)
18
- rspec-core (3.11.0)
19
- rspec-support (~> 3.11.0)
20
- rspec-expectations (3.11.0)
11
+ base64 (0.2.0)
12
+ date (3.4.1)
13
+ debug (1.10.0)
14
+ irb (~> 1.10)
15
+ reline (>= 0.3.8)
16
+ diff-lcs (1.5.1)
17
+ docile (1.4.1)
18
+ doggo (1.4.0)
19
+ rspec-core (~> 3.13)
20
+ drb (2.2.1)
21
+ io-console (0.8.0)
22
+ irb (1.15.1)
23
+ pp (>= 0.6.0)
24
+ rdoc (>= 4.0.0)
25
+ reline (>= 0.4.2)
26
+ pp (0.6.2)
27
+ prettyprint
28
+ prettyprint (0.2.0)
29
+ psych (5.2.3)
30
+ date
31
+ stringio
32
+ rdoc (6.11.0)
33
+ psych (>= 4.0.0)
34
+ reline (0.6.0)
35
+ io-console (~> 0.5)
36
+ rspec (3.13.0)
37
+ rspec-core (~> 3.13.0)
38
+ rspec-expectations (~> 3.13.0)
39
+ rspec-mocks (~> 3.13.0)
40
+ rspec-core (3.13.2)
41
+ rspec-support (~> 3.13.0)
42
+ rspec-expectations (3.13.3)
21
43
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.11.0)
23
- rspec-mocks (3.11.1)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-mocks (3.13.2)
24
46
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.11.0)
26
- rspec-support (3.11.0)
27
- simplecov (0.21.2)
47
+ rspec-support (~> 3.13.0)
48
+ rspec-support (3.13.2)
49
+ simplecov (0.22.0)
28
50
  docile (~> 1.1)
29
51
  simplecov-html (~> 0.11)
30
52
  simplecov_json_formatter (~> 0.1)
31
- simplecov-html (0.12.3)
53
+ simplecov-html (0.13.1)
32
54
  simplecov_json_formatter (0.1.4)
55
+ stringio (3.1.2)
33
56
 
34
57
  PLATFORMS
35
58
  ruby
36
59
 
37
60
  DEPENDENCIES
38
- byebug (~> 11.1)
39
- doggo (~> 1.2)
61
+ debug (~> 1.1)
62
+ doggo (~> 1.4)
40
63
  hubssolib!
41
- rspec (~> 3.8)
42
- rspec-mocks (~> 3.8)
43
- simplecov (~> 0.16)
64
+ rspec (~> 3.13)
65
+ rspec-mocks (~> 3.13)
66
+ simplecov (~> 0.22)
44
67
 
45
68
  BUNDLED WITH
46
- 2.3.17
69
+ 2.6.2
data/README.md CHANGED
@@ -24,28 +24,10 @@ The latest version of the Hub gem source code is available at:
24
24
 
25
25
  ### The Hub library gem
26
26
 
27
- First of all, download and unpack the Hub gem sources. Change into the source directory (usually, `rails/gems/hubssolib`) and build with:
28
-
29
- ```sh
30
- gem build hubssolib.gemspec
31
- ```
32
-
33
- Install the Hub gem using the `gem` command in the usual fashion. For example, for version 1.0.0 of the library, issue the following command:
34
-
35
- ```sh
36
- gem install hubssolib-1.0.0.gem
37
- ```
38
-
39
- If you run multiple gem repositories you can instruct `gem` to install into a specific location using the `--install-dir` command line switch:
40
-
41
- ```sh
42
- gem install hubssolib-1.0.0.gem --install-dir=/home/username/gems
43
- ```
44
-
45
27
  Include in a project by adding this to your `Gemfile`:
46
28
 
47
29
  ```ruby
48
- gem 'hubssolib', '~> 1.0.0', :require => 'hub_sso_lib'
30
+ gem 'hubssolib', '~> 3.0', require: 'hub_sso_lib'
49
31
  ```
50
32
 
51
33
  ### The DRb server
@@ -55,7 +37,7 @@ The Hub DRb server consists of a small wrapper Ruby script which does most of it
55
37
  ```sh
56
38
  HUB_CONNECTION_URI="drbunix:/home/username/sockets/.hub_drb"
57
39
  export HUB_CONNECTION_URI
58
- ruby /home/username/hub/hub_sso_server.rb &
40
+ ruby /home/username/hubssolib/hub_sso_server.rb &
59
41
  ```
60
42
 
61
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.
data/hubssolib.gemspec CHANGED
@@ -4,10 +4,10 @@ spec = Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = 'hubssolib'
6
6
 
7
- s.version = '2.1.0'
7
+ s.version = '3.0.0'
8
8
  s.author = 'Andrew Hodgkinson and others'
9
9
  s.email = 'ahodgkin@rowing.org.uk'
10
- s.homepage = 'http://hub.pond.org.uk/'
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
 
@@ -22,11 +22,14 @@ spec = Gem::Specification.new do |s|
22
22
  EOF
23
23
 
24
24
  s.files = FileList['lib/**/*.rb', '[A-Z]*'].to_a
25
- s.required_ruby_version = '>= 2.5.9' # Not tested on earlier versions
25
+ s.required_ruby_version = '>= 3.0.0' # Not tested on earlier versions
26
26
 
27
- s.add_development_dependency 'byebug', '~> 11.1'
28
- s.add_development_dependency 'simplecov', '~> 0.16'
29
- s.add_development_dependency 'doggo', '~> 1.2'
30
- s.add_development_dependency 'rspec', '~> 3.8'
31
- s.add_development_dependency 'rspec-mocks', '~> 3.8'
27
+ s.add_dependency 'drb', '~> 2.2'
28
+ s.add_dependency 'base64', '~> 0.2'
29
+
30
+ s.add_development_dependency 'debug', '~> 1.1'
31
+ s.add_development_dependency 'simplecov', '~> 0.22'
32
+ s.add_development_dependency 'doggo', '~> 1.4'
33
+ s.add_development_dependency 'rspec', '~> 3.13'
34
+ s.add_development_dependency 'rspec-mocks', '~> 3.13'
32
35
  end
data/lib/hub_sso_lib.rb CHANGED
@@ -427,7 +427,7 @@ module HubSsoLib
427
427
  # The returned object is proxied via DRb - it is shared between processes.
428
428
  #
429
429
  # +key+:: Session key; lazy-initialises a new session under this key
430
- # if none is found, then immeediately rotates it.
430
+ # if none is found, then immediately rotates it.
431
431
  #
432
432
  # +remote_ip+:: Request's remote IP address. If there is an existing
433
433
  # session which matches this, it's returned. If there is an
@@ -518,6 +518,27 @@ module HubSsoLib
518
518
  !!self.hubssolib_current_user
519
519
  end
520
520
 
521
+ # Returns markup for a link that leads to Hub's conditional login endpoint,
522
+ # inline-styled as a red "Log in" or green "Account" button. This can be
523
+ # used in page templates to avoid needing any additional images or other
524
+ # such resources and using pure HTML + CSS for the login indication.
525
+ #
526
+ def hubssolib_account_link
527
+ logged_in = self.hubssolib_logged_in?()
528
+
529
+ text, klass, style = if logged_in
530
+ ['Account', 'hubssolib_logged_in', 'border: 1px solid #050; color: #050; background: #efe;']
531
+ else
532
+ ['Log in', 'hubssolib_logged_out', 'border: 1px solid #500; color: #500; background: #fee;']
533
+ end
534
+
535
+ style << ' display: block; width: 88px; height; 20px;'
536
+ style << ' text-align: center; line-height: 20px;'
537
+ style << ' font: sans-serif; font-size: 10pt'
538
+
539
+ "<a href=\"#{HUB_PATH_PREFIX}/account/login_conditional\" class=\"#{klass}\" style=\"#{style}\">#{text}</a>".html_safe()
540
+ end
541
+
521
542
  # Check if the user is authorized to perform the current action. If calling
522
543
  # from a helper, pass the action name and class name; otherwise by default,
523
544
  # the current action name and 'self.class' will be used.
@@ -855,6 +876,7 @@ module HubSsoLib
855
876
  :hubssolib_current_user,
856
877
  :hubssolib_unique_name,
857
878
  :hubssolib_logged_in?,
879
+ :hubssolib_account_link,
858
880
  :hubssolib_authorized?,
859
881
  :hubssolib_privileged?,
860
882
  :hubssolib_flash_data
metadata CHANGED
@@ -1,85 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubssolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hodgkinson and others
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-07-01 00:00:00.000000000 Z
10
+ date: 2025-01-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: byebug
13
+ name: drb
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '11.1'
18
+ version: '2.2'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.2'
26
+ - !ruby/object:Gem::Dependency
27
+ name: base64
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.2'
40
+ - !ruby/object:Gem::Dependency
41
+ name: debug
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.1'
20
47
  type: :development
21
48
  prerelease: false
22
49
  version_requirements: !ruby/object:Gem::Requirement
23
50
  requirements:
24
51
  - - "~>"
25
52
  - !ruby/object:Gem::Version
26
- version: '11.1'
53
+ version: '1.1'
27
54
  - !ruby/object:Gem::Dependency
28
55
  name: simplecov
29
56
  requirement: !ruby/object:Gem::Requirement
30
57
  requirements:
31
58
  - - "~>"
32
59
  - !ruby/object:Gem::Version
33
- version: '0.16'
60
+ version: '0.22'
34
61
  type: :development
35
62
  prerelease: false
36
63
  version_requirements: !ruby/object:Gem::Requirement
37
64
  requirements:
38
65
  - - "~>"
39
66
  - !ruby/object:Gem::Version
40
- version: '0.16'
67
+ version: '0.22'
41
68
  - !ruby/object:Gem::Dependency
42
69
  name: doggo
43
70
  requirement: !ruby/object:Gem::Requirement
44
71
  requirements:
45
72
  - - "~>"
46
73
  - !ruby/object:Gem::Version
47
- version: '1.2'
74
+ version: '1.4'
48
75
  type: :development
49
76
  prerelease: false
50
77
  version_requirements: !ruby/object:Gem::Requirement
51
78
  requirements:
52
79
  - - "~>"
53
80
  - !ruby/object:Gem::Version
54
- version: '1.2'
81
+ version: '1.4'
55
82
  - !ruby/object:Gem::Dependency
56
83
  name: rspec
57
84
  requirement: !ruby/object:Gem::Requirement
58
85
  requirements:
59
86
  - - "~>"
60
87
  - !ruby/object:Gem::Version
61
- version: '3.8'
88
+ version: '3.13'
62
89
  type: :development
63
90
  prerelease: false
64
91
  version_requirements: !ruby/object:Gem::Requirement
65
92
  requirements:
66
93
  - - "~>"
67
94
  - !ruby/object:Gem::Version
68
- version: '3.8'
95
+ version: '3.13'
69
96
  - !ruby/object:Gem::Dependency
70
97
  name: rspec-mocks
71
98
  requirement: !ruby/object:Gem::Requirement
72
99
  requirements:
73
100
  - - "~>"
74
101
  - !ruby/object:Gem::Version
75
- version: '3.8'
102
+ version: '3.13'
76
103
  type: :development
77
104
  prerelease: false
78
105
  version_requirements: !ruby/object:Gem::Requirement
79
106
  requirements:
80
107
  - - "~>"
81
108
  - !ruby/object:Gem::Version
82
- version: '3.8'
109
+ version: '3.13'
83
110
  description: |2
84
111
  The Hub SSO Library supports single sign-on across multiple Rails
85
112
  applications on the same host. The Hub application provides account
@@ -99,11 +126,10 @@ files:
99
126
  - README.md
100
127
  - hubssolib.gemspec
101
128
  - lib/hub_sso_lib.rb
102
- homepage: http://hub.pond.org.uk/
129
+ homepage: http://pond.org.uk/
103
130
  licenses:
104
131
  - MIT
105
132
  metadata: {}
106
- post_install_message:
107
133
  rdoc_options: []
108
134
  require_paths:
109
135
  - lib
@@ -111,15 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
137
  requirements:
112
138
  - - ">="
113
139
  - !ruby/object:Gem::Version
114
- version: 2.5.9
140
+ version: 3.0.0
115
141
  required_rubygems_version: !ruby/object:Gem::Requirement
116
142
  requirements:
117
143
  - - ">="
118
144
  - !ruby/object:Gem::Version
119
145
  version: '0'
120
146
  requirements: []
121
- rubygems_version: 3.2.3
122
- signing_key:
147
+ rubygems_version: 3.6.2
123
148
  specification_version: 4
124
149
  summary: Cross-application single sign-on support library.
125
150
  test_files: []