Skip to content

Commit 75c8a0e

Browse files
committed
Merge remote-tracking branch 'remotes/johnnyshields/v2.x-nokogiri-parrtial-upgrade-phase-3' into v2.x-decryption-refactor
2 parents 43b3f8c + 2d78398 commit 75c8a0e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ or underscore, and can only contain letters, digits, underscores, hyphens, and p
928928
### Custom Metadata Fields
929929

930930
Some IdPs may require to add SPs to add additional fields (Organization, ContactPerson, etc.)
931-
into the SP metadata. This can be achieved by extending the `RubySaml::Metadata` class and
931+
into the SP metadata. This can be done by extending the `RubySaml::Metadata` class and
932932
overriding the `#add_extras` method using a Nokogiri XML builder as per the following example:
933933

934934
```ruby

UPGRADING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA256
1818
settings.security[:digest_method] = XMLSecurity::Document::SHA256
1919
```
2020

21+
### JRuby users should upgrade to JRuby 1.19 or later
22+
23+
JRuby users should upgrade to Nokogiri gem version 1.19 or later, to avoid
24+
[this Nokogiri issue affecting how XML is generated on JRuby](https://github.com/sparklemotion/nokogiri/pull/3456).
25+
This issue is likely not critical for most IdPs, but since it is not tested, it is recommended to upgrade.
26+
2127
### Root "OneLogin" namespace changed to "RubySaml"
2228

2329
RubySaml version `2.0.0` changes the root namespace from `OneLogin::RubySaml::` to just `RubySaml::`.

lib/ruby_saml/metadata.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ class Metadata
1414
# @param valid_until [DateTime] Metadata's valid time
1515
# @param cache_duration [Integer] Duration of the cache in seconds
1616
# @return [String] XML Metadata of the Service Provider
17-
def generate(settings, pretty_print=false, valid_until=nil, cache_duration=nil)
17+
def generate(settings, pretty_print = false, valid_until = nil, cache_duration = nil)
1818
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
1919
root_attributes = {
20-
'xmlns:md' => 'urn:oasis:names:tc:SAML:2.0:metadata',
20+
'xmlns:md' => RubySaml::XML::NS_METADATA,
21+
'xmlns:ds' => RubySaml::XML::DSIG,
2122
'ID' => RubySaml::Utils.uuid,
2223
'entityID' => settings.sp_entity_id
2324
}
@@ -151,7 +152,7 @@ def output_xml(meta_doc, pretty_print)
151152
def add_certificate_element(xml, cert, use)
152153
cert_text = Base64.strict_encode64(cert.to_der)
153154
xml['md'].KeyDescriptor('use' => use.to_s) do
154-
xml['ds'].KeyInfo('xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#') do
155+
xml['ds'].KeyInfo do
155156
xml['ds'].X509Data do
156157
xml['ds'].X509Certificate(cert_text)
157158
end

0 commit comments

Comments
 (0)