Skip to content

Commit 2d78398

Browse files
committed
Fix jruby specs
1 parent 0bdcc94 commit 2d78398

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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.encode64(cert.to_der).delete("\n")
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

lib/ruby_saml/xml.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ module XML
3535
SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
3636
ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
3737

38+
NS_METADATA = 'urn:oasis:names:tc:SAML:2.0:metadata'
39+
3840
NOKOGIRI_OPTIONS = Nokogiri::XML::ParseOptions::STRICT |
3941
Nokogiri::XML::ParseOptions::NONET
4042

0 commit comments

Comments
 (0)