hubssolib 2.0.0 → 2.1.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: 9309369683fa647e559c4a87d5569e215d25f472b2acdb6869b538807a42ecf2
4
- data.tar.gz: 6b4ffb49a16835ceac8436c6ebd5d9270fe9ea1af2d9c1de07616e2b38f5cd5e
3
+ metadata.gz: 5fafbf54747841c2d90eaa755481e8c1eecf9e060d64e62d7ff6a446acf2bbc4
4
+ data.tar.gz: 2243d8561879026aedc904f6505e3a38e2193db7ed5d94540bc520976e15ef23
5
5
  SHA512:
6
- metadata.gz: 8b4d75adcceea21ca4b95b49410a20667b7a1088e7f0bcf63e267699a779ba8e1ececcf2a5d5894274f7f12fe47eb4694bc948df912d625c86aece3dfc6551a7
7
- data.tar.gz: 7c6aea5a1261203b6c74872620cbb7195e53cb9b545df6dea252bb0c4dce7c25260891d0ee7ceca8b1a85da29fb8669a7fb8346202f972d3263e199efd1df26c
6
+ metadata.gz: a3653217e5809704a69b20fcae5f94a3066ed26085fdced81c36c8f8bf99b9299212ddf51fde2af411790dd51ebcbd004fe4993c61c0a6588e39f8b080a6abce
7
+ data.tar.gz: 437fa627ad45ae7baa8e9772a3c1157db324d7b62d889fb53eb81b395317b985b02a5d04ee1f4e7cd1111de3ca24ed16376913ad0b5328b4e630ff241167d793
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- ## Version 1 -> Version 2.0.0, 19-Apr-2020
1
+ ## 2.1.0, 01-Jul-2022
2
+
3
+ * Use `HUB_QUIET_SERVER=yes ...` to quieten `$stdout` output from Hub server.
4
+ * Test coverage fixed (overlooked in v2.0.0 release).
5
+ * Maintenance `bundle update`.
6
+ * A few minor tidy-ups in the implementation.
7
+
8
+ ## Version 1.0.0 -> Version 2.0.0, 19-Apr-2020
2
9
 
3
10
  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.
4
11
 
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec # See hubssolib.gemspec
data/Gemfile.lock CHANGED
@@ -1,13 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubssolib (2.0.0)
4
+ hubssolib (2.1.0)
5
5
 
6
6
  GEM
7
- remote: http://rubygems.org/
7
+ remote: https://rubygems.org/
8
8
  specs:
9
+ byebug (11.1.3)
9
10
  diff-lcs (1.5.0)
10
11
  docile (1.4.0)
12
+ doggo (1.2.0)
13
+ rspec-core (~> 3.10)
11
14
  rspec (3.11.0)
12
15
  rspec-core (~> 3.11.0)
13
16
  rspec-expectations (~> 3.11.0)
@@ -32,6 +35,8 @@ PLATFORMS
32
35
  ruby
33
36
 
34
37
  DEPENDENCIES
38
+ byebug (~> 11.1)
39
+ doggo (~> 1.2)
35
40
  hubssolib!
36
41
  rspec (~> 3.8)
37
42
  rspec-mocks (~> 3.8)
data/hubssolib.gemspec CHANGED
@@ -4,11 +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.0.0'
7
+ s.version = '2.1.0'
8
8
  s.author = 'Andrew Hodgkinson and others'
9
9
  s.email = 'ahodgkin@rowing.org.uk'
10
10
  s.homepage = 'http://hub.pond.org.uk/'
11
- s.date = File.ctime('VERSION')
12
11
  s.summary = 'Cross-application single sign-on support library.'
13
12
  s.license = 'MIT'
14
13
 
@@ -25,7 +24,9 @@ spec = Gem::Specification.new do |s|
25
24
  s.files = FileList['lib/**/*.rb', '[A-Z]*'].to_a
26
25
  s.required_ruby_version = '>= 2.5.9' # Not tested on earlier versions
27
26
 
28
- s.add_development_dependency 'simplecov', '~> 0.16'
29
- s.add_development_dependency 'rspec', '~> 3.8'
30
- s.add_development_dependency 'rspec-mocks', '~> 3.8'
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'
31
32
  end
data/lib/hub_sso_lib.rb CHANGED
@@ -75,7 +75,7 @@ module HubSsoLib
75
75
  def self.deserialise_object(data)
76
76
  Marshal.load(Base64.strict_decode64(data)) rescue nil
77
77
  end
78
- end # Crypto class
78
+ end # Serialiser class
79
79
 
80
80
  #######################################################################
81
81
  # Class: Roles #
@@ -409,9 +409,10 @@ module HubSsoLib
409
409
 
410
410
  class SessionFactory
411
411
  def initialize
412
- puts "Session factory: Awaken"
413
-
412
+ @hub_be_quiet = ! ENV['HUB_QUIET_SERVER'].nil?
414
413
  @hub_sessions = {}
414
+
415
+ puts "Session factory: Awaken" unless @hub_be_quiet
415
416
  end
416
417
 
417
418
  # Get a session using a given key (a UUID). Generates a new session if
@@ -434,23 +435,25 @@ module HubSsoLib
434
435
  # invalid and discarded.
435
436
  #
436
437
  def get_hub_session_proxy(key, remote_ip)
437
- retrieve_existing = @hub_sessions.has_key?(key)
438
- message = retrieve_existing ? 'Retrieving' : 'Created'
439
- new_key = SecureRandom.uuid
438
+ hub_session = @hub_sessions[key]
439
+ message = hub_session.nil? ? 'Created' : 'Retrieving'
440
+ new_key = SecureRandom.uuid
440
441
 
441
- puts "#{message} session for key #{key} and rotating to #{new_key}"
442
+ unless @hub_be_quiet
443
+ puts "#{ message } session for key #{ key } and rotating to #{ new_key }"
444
+ end
442
445
 
443
- if retrieve_existing
444
- hub_session = @hub_sessions[key]
445
- if remote_ip != hub_session.session_ip
446
- puts "WARNING: IP address changed from #{hub_session.session_ip} to #{remote_ip} -> discarding session"
447
- hub_session = @hub_sessions[key] = HubSsoLib::Session.new
446
+ unless hub_session.nil? || hub_session.session_ip == remote_ip
447
+ unless @hub_be_quiet
448
+ puts "WARNING: IP address changed from #{ hub_session.session_ip } to #{ remote_ip } -> discarding session"
448
449
  end
449
450
 
450
- else
451
- hub_session = @hub_sessions[key] = HubSsoLib::Session.new
452
- hub_session.session_ip = remote_ip
451
+ hub_session = nil
452
+ end
453
453
 
454
+ if hub_session.nil?
455
+ hub_session = HubSsoLib::Session.new
456
+ hub_session.session_ip = remote_ip
454
457
  end
455
458
 
456
459
  @hub_sessions.delete(key)
@@ -483,7 +486,7 @@ module HubSsoLib
483
486
 
484
487
  module Server
485
488
  def hubssolib_launch_server
486
- puts "Server: Starting at #{ HUB_CONNECTION_URI }"
489
+ puts "Server: Starting at #{ HUB_CONNECTION_URI }" unless ENV['HUB_QUIET_SERVER'].nil?
487
490
 
488
491
  @@hub_session_factory = HubSsoLib::SessionFactory.new
489
492
  DRb.start_service(HUB_CONNECTION_URI, @@hub_session_factory, { :safe_level => 1 })
@@ -819,7 +822,7 @@ module HubSsoLib
819
822
  keys = ordered_keys | hash.keys
820
823
 
821
824
  keys.each do | key |
822
- compiled_data[ 'hub' ][ key ] = hash[ key ] if hash.has_key?( key )
825
+ compiled_data['hub'][key] = hash[key] if hash.key?(key)
823
826
  end
824
827
 
825
828
  if defined?( flash )
@@ -827,7 +830,7 @@ module HubSsoLib
827
830
  keys = ordered_keys | hash.keys
828
831
 
829
832
  keys.each do | key |
830
- compiled_data[ 'standard' ][ key ] = hash[ key ] if hash.has_key?( key )
833
+ compiled_data['standard'][key] = hash[key] if hash.key?(key)
831
834
  end
832
835
  end
833
836
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubssolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hodgkinson and others
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-30 00:00:00.000000000 Z
11
+ date: 2022-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: byebug
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '11.1'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '11.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: simplecov
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +38,20 @@ dependencies:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: doggo
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rspec
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +97,6 @@ files:
69
97
  - Gemfile
70
98
  - Gemfile.lock
71
99
  - README.md
72
- - VERSION
73
100
  - hubssolib.gemspec
74
101
  - lib/hub_sso_lib.rb
75
102
  homepage: http://hub.pond.org.uk/
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.0.0 (19-Apr-2020)