Skip to content

Commit 3077950

Browse files
committed
Drop support for versions Ruby < 2.6 and JRuby < jruby-9.3
1 parent c9685a9 commit 3077950

File tree

9 files changed

+22
-129
lines changed

9 files changed

+22
-129
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-20.04, macos-latest]
12-
ruby-version: [2.1.9, 2.2.10, 2.3.8, 2.4.6, 2.5.8, 2.6.6, 2.7.2, 3.0.1, 3.1, 3.2, jruby-9.1.17.0, jruby-9.2.17.0, jruby-9.3.2.0, jruby-9.4.0.0, truffleruby]
12+
ruby-version: [2.6.6, 2.7.2, 3.0.1, 3.1, 3.2, jruby-9.3.2.0, jruby-9.4.0.0, truffleruby]
1313
runs-on: ${{ matrix.os }}
1414
steps:
1515
- uses: actions/checkout@v2

Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@
44
source 'https://rubygems.org'
55

66
gemspec
7+
8+
gem 'minitest', '~> 5.5'
9+
gem 'mocha', '~> 0.14'
10+
gem 'rake', '>= 12.3.3'
11+
gem 'shoulda', '~> 2.11'
12+
gem 'simplecov', '< 0.22.0'
13+
gem 'simplecov-lcov', '> 0.7.0'
14+
gem 'systemu', '~> 2'
15+
gem 'timecop', '~> 0.9'

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@ We created a demo project for Rails 4 that uses the latest version of this libra
2020

2121
### Supported Ruby Versions
2222

23-
The following Ruby versions are covered by CI testing:
24-
25-
* 2.1.x
26-
* 2.2.x
27-
* 2.3.x
28-
* 2.4.x
29-
* 2.5.x
30-
* 2.6.x
31-
* 2.7.x
32-
* 3.0.x
23+
* 2.6
24+
* 2.7
25+
* 3.0
3326
* 3.1
3427
* 3.2
35-
* JRuby 9.1.x
36-
* JRuby 9.2.x
37-
* JRuby 9.3.X
38-
* JRuby 9.4.0
28+
* JRuby 9.3
29+
* JRuby 9.4
3930
* TruffleRuby (latest)
4031

41-
In addition, the following may work but are untested:
42-
43-
* 1.8.7
44-
* 1.9.x
45-
* 2.0.x
46-
* JRuby 1.7.x
47-
* JRuby 9.0.x
32+
For older Ruby support, please refer to older major versions of Ruby SAML.
4833

4934
## Adding Features, Pull Requests
5035

lib/onelogin/ruby-saml/idp_metadata_parser.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,6 @@ def get_idp_metadata(url, validate_cert)
202202
http.use_ssl = true
203203
# Most IdPs will probably use self signed certs
204204
http.verify_mode = validate_cert ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
205-
206-
# Net::HTTP in Ruby 1.8 did not set the default certificate store
207-
# automatically when VERIFY_PEER was specified.
208-
if RUBY_VERSION < '1.9' && !http.ca_file && !http.ca_path && !http.cert_store
209-
http.cert_store = OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
210-
end
211205
end
212206

213207
get = Net::HTTP::Get.new(uri.request_uri)

lib/onelogin/ruby-saml/response.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -973,12 +973,7 @@ def generate_decrypted_document
973973
raise ValidationError.new('An EncryptedAssertion found and no SP private key found on the settings to decrypt it. Be sure you provided the :settings parameter at the initialize method')
974974
end
975975

976-
# Marshal at Ruby 1.8.7 throw an Exception
977-
if RUBY_VERSION < "1.9"
978-
document_copy = XMLSecurity::SignedDocument.new(response, errors)
979-
else
980-
document_copy = Marshal.load(Marshal.dump(document))
981-
end
976+
document_copy = Marshal.load(Marshal.dump(document))
982977

983978
decrypt_assertion_from_document(document_copy)
984979
end

lib/onelogin/ruby-saml/utils.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
if RUBY_VERSION < '1.9'
2-
require 'uuid'
3-
else
4-
require 'securerandom'
5-
end
1+
require 'securerandom'
62
require "openssl"
73

84
module OneLogin
@@ -11,8 +7,6 @@ module RubySaml
117
# SAML2 Auxiliary class
128
#
139
class Utils
14-
@@uuid_generator = UUID.new if RUBY_VERSION < '1.9'
15-
1610
BINDINGS = { :post => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST".freeze,
1711
:redirect => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect".freeze }.freeze
1812
DSIG = "http://www.w3.org/2000/09/xmldsig#".freeze
@@ -56,8 +50,6 @@ def self.is_cert_expired(cert)
5650
# @return [Integer] The new timestamp, after the duration is applied.
5751
#
5852
def self.parse_duration(duration, timestamp=Time.now.utc)
59-
return nil if RUBY_VERSION < '1.9' # 1.8.7 not supported
60-
6153
matches = duration.match(DURATION_FORMAT)
6254

6355
if matches.nil?
@@ -348,7 +340,7 @@ def self.set_prefix(value)
348340
end
349341

350342
def self.uuid
351-
"#{UUID_PREFIX}" + (RUBY_VERSION < '1.9' ? "#{@@uuid_generator.generate}" : "#{SecureRandom.uuid}")
343+
"#{UUID_PREFIX}#{SecureRandom.uuid}"
352344
end
353345

354346
# Given two strings, attempt to match them as URIs using Rails' parse method. If they can be parsed,

ruby-saml.gemspec

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -20,85 +20,9 @@ Gem::Specification.new do |s|
2020
s.rdoc_options = ["--charset=UTF-8"]
2121
s.require_paths = ["lib"]
2222
s.rubygems_version = %q{1.3.7}
23-
s.required_ruby_version = '>= 1.8.7'
23+
s.required_ruby_version = '>= 2.6.0'
2424
s.summary = %q{SAML Ruby Tookit}
2525

26-
# Because runtime dependencies are determined at build time, we cannot make
27-
# Nokogiri's version dependent on the Ruby version, even though we would
28-
# have liked to constrain Ruby 1.8.7 to install only the 1.5.x versions.
29-
if defined?(JRUBY_VERSION)
30-
if JRUBY_VERSION < '9.1.7.0'
31-
s.add_runtime_dependency('nokogiri', '>= 1.8.2', '<= 1.8.5')
32-
s.add_runtime_dependency('jruby-openssl', '>= 0.9.8')
33-
s.add_runtime_dependency('json', '< 2.3.0')
34-
elsif JRUBY_VERSION < '9.2.0.0'
35-
s.add_runtime_dependency('nokogiri', '>= 1.9.1', '< 1.10.0')
36-
elsif JRUBY_VERSION < '9.3.2.0'
37-
s.add_runtime_dependency('nokogiri', '>= 1.11.4')
38-
s.add_runtime_dependency('rexml')
39-
else
40-
s.add_runtime_dependency('nokogiri', '>= 1.13.10')
41-
s.add_runtime_dependency('rexml')
42-
end
43-
elsif RUBY_VERSION < '1.9'
44-
s.add_runtime_dependency('uuid')
45-
s.add_runtime_dependency('nokogiri', '<= 1.5.11')
46-
elsif RUBY_VERSION < '2.1'
47-
s.add_runtime_dependency('nokogiri', '>= 1.5.10', '<= 1.6.8.1')
48-
s.add_runtime_dependency('json', '< 2.3.0')
49-
elsif RUBY_VERSION < '2.3'
50-
s.add_runtime_dependency('nokogiri', '>= 1.9.1', '< 1.10.0')
51-
elsif RUBY_VERSION < '2.5'
52-
s.add_runtime_dependency('nokogiri', '>= 1.10.10', '< 1.11.0')
53-
s.add_runtime_dependency('rexml')
54-
elsif RUBY_VERSION < '2.6'
55-
s.add_runtime_dependency('nokogiri', '>= 1.11.4')
56-
s.add_runtime_dependency('rexml')
57-
else
58-
s.add_runtime_dependency('nokogiri', '>= 1.13.10')
59-
s.add_runtime_dependency('rexml')
60-
end
61-
62-
s.add_development_dependency('simplecov', '<0.22.0')
63-
if RUBY_VERSION < '2.4.1'
64-
s.add_development_dependency('simplecov-lcov', '<0.8.0')
65-
else
66-
s.add_development_dependency('simplecov-lcov', '>0.7.0')
67-
end
68-
69-
s.add_development_dependency('minitest', '~> 5.5')
70-
s.add_development_dependency('mocha', '~> 0.14')
71-
72-
if RUBY_VERSION < '2.0'
73-
s.add_development_dependency('rake', '~> 10')
74-
else
75-
s.add_development_dependency('rake', '>= 12.3.3')
76-
end
77-
78-
s.add_development_dependency('shoulda', '~> 2.11')
79-
s.add_development_dependency('systemu', '~> 2')
80-
81-
if RUBY_VERSION < '2.1'
82-
s.add_development_dependency('timecop', '<= 0.6.0')
83-
else
84-
s.add_development_dependency('timecop', '~> 0.9')
85-
end
86-
87-
if defined?(JRUBY_VERSION)
88-
# All recent versions of JRuby play well with pry
89-
s.add_development_dependency('pry')
90-
elsif RUBY_VERSION < '1.9'
91-
# 1.8.7
92-
s.add_development_dependency('ruby-debug', '~> 0.10.4')
93-
elsif RUBY_VERSION < '2.0'
94-
# 1.9.x
95-
s.add_development_dependency('debugger-linecache', '~> 1.2.0')
96-
s.add_development_dependency('debugger', '~> 1.6.4')
97-
elsif RUBY_VERSION < '2.1'
98-
# 2.0.x
99-
s.add_development_dependency('byebug', '~> 2.1.1')
100-
else
101-
# 2.1.x, 2.2.x
102-
s.add_development_dependency('pry-byebug')
103-
end
26+
s.add_dependency('nokogiri', '>= 1.13.10')
27+
s.add_dependency('rexml')
10428
end

test/idp_metadata_parser_test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,16 +419,13 @@ def initialize; end
419419
end
420420

421421
it "if no ValidUntil but CacheDuration return CacheDuration converted in ValidUntil" do
422-
return if RUBY_VERSION < '1.9'
423422
Timecop.freeze(Time.parse("2020-01-02T10:02:33Z", Time.now.utc)) do
424423
settings = @idp_metadata_parser.parse(idp_metadata_descriptor5)
425424
assert_equal '2020-01-03T10:02:33Z', settings.valid_until
426425
end
427426
end
428427

429428
it "if ValidUntil and CacheDuration return the sooner timestamp" do
430-
return if RUBY_VERSION < '1.9'
431-
432429
Timecop.freeze(Time.parse("2020-01-01T10:12:55Z", Time.now.utc)) do
433430
settings = @idp_metadata_parser.parse(idp_metadata_descriptor6)
434431
assert_equal '2020-01-03T10:12:55Z', settings.valid_until

test/utils_test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,19 @@ class UtilsTest < Minitest::Test
2222
}
2323

2424
def result(duration, reference = 0)
25-
return nil if RUBY_VERSION < '1.9'
2625
Time.at(
2726
OneLogin::RubySaml::Utils.parse_duration(duration, reference)
2827
).utc.iso8601(3)
2928
end
3029

3130
DURATIONS_FROM_EPOCH.each do |duration, expected|
3231
it "parses #{duration} to return #{expected} from the given timestamp" do
33-
return if RUBY_VERSION < '1.9'
3432
assert_equal expected, result(duration)
3533
end
3634
end
3735

3836
it "returns the last calendar day of the next month when advancing from a longer month to a shorter one" do
3937
initial_timestamp = Time.iso8601("1970-01-31T00:00:00.000Z").to_i
40-
return if RUBY_VERSION < '1.9'
4138
assert_equal "1970-02-28T00:00:00.000Z", result("P1M", initial_timestamp)
4239
end
4340
end

0 commit comments

Comments
 (0)