Skip to content

Commit 4620c53

Browse files
authored
Merge pull request #609 from johnnyshields/drop-eol-ruby-support
Drop support for Ruby < 2.6 and JRuby < 9.3
2 parents c9685a9 + 25a9493 commit 4620c53

23 files changed

+72
-157
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,27 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
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]
11+
os: [ubuntu-20.04] # macos-latest
12+
ruby-version: [2.6, 2.7, 3.0, 3.1, 3.2, jruby-9.3, jruby-9.4, truffleruby]
13+
include:
14+
- os: macos-latest
15+
ruby-version: 2.6
16+
- os: macos-latest
17+
ruby-version: 2.7
18+
- os: macos-latest
19+
ruby-version: 3.0
20+
- os: macos-latest
21+
ruby-version: 3.1
22+
- os: macos-latest
23+
ruby-version: 3.2
24+
- os: macos-latest
25+
ruby-version: jruby-9.3
26+
# 2023/03/07 - JRuby 9.4 on MacOS is skipped for now.
27+
# Seems to be a JRuby-side issue.
28+
# - os: macos-latest
29+
# ruby-version: jruby-9.4
30+
- os: macos-latest
31+
ruby-version: truffleruby
1332
runs-on: ${{ matrix.os }}
1433
steps:
1534
- uses: actions/checkout@v2
@@ -26,6 +45,9 @@ jobs:
2645

2746
- name: Coveralls
2847
uses: coverallsapp/github-action@master
48+
# 2023/03/07 - Simplecov is not working on TruffleRuby.
49+
# TruffleRuby tests are otherwise passing.
50+
if: ${{ matrix.ruby-version != 'truffleruby' }}
2951
with:
3052
github-token: ${{ secrets.github_token }}
3153
parallel: true

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Ruby SAML Changelog
2+
23
### 1.15.0 (Jan 04, 2023)
34
* [#650](https://github.com/SAML-Toolkits/ruby-saml/pull/650) Replace strip! by strip on compute_digest method
45
* [#638](https://github.com/SAML-Toolkits/ruby-saml/pull/638) Fix dateTime format for the validUntil attribute of the generated metadata

Gemfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
#
21
# Please keep this file alphabetized and organized
32
#
43
source 'https://rubygems.org'
54

65
gemspec
6+
7+
gem 'minitest', '~> 5.18', require: false
8+
gem 'mocha', '~> 2.0', require: false
9+
gem 'rake', '~> 13.0'
10+
gem 'simplecov', '~> 0.22', require: false
11+
gem 'simplecov-lcov', '~> 0.8', require: false
12+
gem 'timecop', '~> 0.9', require: false

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/attributes_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
1+
require_relative 'test_helper'
22

33
require 'onelogin/ruby-saml/attributes'
44

test/idp_metadata_parser_test.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
1+
require_relative 'test_helper'
22

33
require 'onelogin/ruby-saml/idp_metadata_parser'
44

@@ -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

0 commit comments

Comments
 (0)