Skip to content

Commit 8748250

Browse files
Merge Master branch to 2.x (#696)
* Make IdpMetadataParser#get_idp_metadata public * Fix tests on Windows and cleanup CI --------- Co-authored-by: Caleb Hearth <caleb.hearth@files.com>
1 parent 3e31760 commit 8748250

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ jobs:
1111
os:
1212
- ubuntu-20.04
1313
- macos-latest
14+
- windows-latest
1415
ruby-version:
1516
- 3.0
1617
- 3.1
1718
- 3.2
19+
- 3.3
1820
- jruby-9.4
1921
- truffleruby
22+
exclude:
23+
- os: windows-latest
24+
ruby-version: jruby-9.4
25+
- os: windows-latest
26+
ruby-version: truffleruby
2027
runs-on: ${{ matrix.os }}
2128
steps:
22-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
2330
- name: Set up Ruby ${{ matrix.ruby-version }}
2431
uses: ruby/setup-ruby@v1
2532
with:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
* [#690](https://github.com/SAML-Toolkits/ruby-saml/pull/690) Remove deprecated `settings.security[:embed_sign]` parameter.
1212

1313
### 1.17.0
14+
* [#687](https://github.com/SAML-Toolkits/ruby-saml/pull/687) Add CI coverage for Ruby 3.3 and Windows.
1415
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Add `Settings#sp_cert_multi` paramter to facilitate SP certificate and key rotation.
1516
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Support multiple simultaneous SP decryption keys via `Settings#sp_cert_multi` parameter.
1617
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Deprecate `Settings#certificate_new` parameter.
1718
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) `:check_sp_cert_expiration` will use the first non-expired certificate/key when signing/decrypting. It will raise an error only if there are no valid certificates/keys.
1819
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) `:check_sp_cert_expiration` now validates the certificate `not_before` condition; previously it was only validating `not_after`.
1920
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) `:check_sp_cert_expiration` now causes the generated SP metadata to exclude any inactive/expired certificates.
21+
* [#691](https://github.com/SAML-Toolkits/ruby-saml/pull/691) Make IdpMetadataParser#get_idp_metadata public.
2022

2123
### 1.16.0 (Oct 09, 2023)
2224
* [#671](https://github.com/SAML-Toolkits/ruby-saml/pull/671) Add support on LogoutRequest with Encrypted NameID

README.md

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

2121
### Supported Ruby Versions
2222

23-
* 3.0
24-
* 3.1
25-
* 3.2
26-
* JRuby 9.3
23+
The following Ruby versions are covered by CI testing:
24+
25+
* Ruby (MRI) 3.0 to 3.3
2726
* JRuby 9.4
2827
* TruffleRuby (latest)
2928

30-
For older Ruby support, please refer to older major versions of Ruby SAML.
29+
Older Ruby versions are supported on the 1.x release of Ruby SAML.
3130

3231
## Adding Features, Pull Requests
3332

@@ -989,4 +988,4 @@ be written entirely in future versions.
989988
990989
## License
991990
992-
RubySaml is made available under the MIT License. Refer to [LICENSE](LICENSE).
991+
Ruby SAML is made available under the MIT License. Refer to [LICENSE](LICENSE).

lib/ruby_saml/idp_metadata_parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ def parse_to_idp_metadata_array(idp_metadata, options = {})
185185
idpsso_descriptors.map {|id| IdpMetadata.new(id, id.parent.attributes["entityID"])}
186186
end
187187

188-
private
189-
190188
# Retrieve the remote IdP metadata from the URL or a cached copy.
191189
# @param url [String] Url where the XML of the Identity Provider Metadata is published.
192190
# @param validate_cert [Boolean] If true and the URL is HTTPs, the cert of the domain is checked.
@@ -213,6 +211,8 @@ def get_idp_metadata(url, validate_cert)
213211
)
214212
end
215213

214+
private
215+
216216
class IdpMetadata
217217
attr_reader :idpsso_descriptor, :entity_id
218218

lib/ruby_saml/utils.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,20 @@ def self.parse_duration(duration, timestamp=Time.now.utc)
6868
sign = matches[1] == '-' ? -1 : 1
6969

7070
durYears, durMonths, durDays, durHours, durMinutes, durSeconds, durWeeks =
71-
matches[2..8].map { |match| match ? sign * match.tr(',', '.').to_f : 0.0 }
71+
matches[2..8].map do |match|
72+
if match
73+
match = match.tr(',', '.').gsub(/\.0*\z/, '')
74+
sign * (match.include?('.') ? match.to_f : match.to_i)
75+
else
76+
0
77+
end
78+
end
7279

73-
initial_datetime = Time.at(timestamp).utc.to_datetime
74-
final_datetime = initial_datetime.next_year(durYears)
75-
final_datetime = final_datetime.next_month(durMonths)
76-
final_datetime = final_datetime.next_day((7*durWeeks) + durDays)
77-
final_datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
80+
datetime = Time.at(timestamp).utc.to_datetime
81+
datetime = datetime.next_year(durYears)
82+
datetime = datetime.next_month(durMonths)
83+
datetime = datetime.next_day((7*durWeeks) + durDays)
84+
datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
7885
end
7986

8087
# Return a properly formatted x509 certificate

0 commit comments

Comments
 (0)