11# Ruby SAML Migration Guide
22
3- ## Updating from 1.x to 2.0.0
3+ ## Upgrading from 1.x to 2.0.0
44
55** IMPORTANT: Please read this section carefully as it contains breaking changes!**
66
@@ -34,7 +34,7 @@ Note that the project folder structure has also been updated accordingly. Notabl
3434` lib/onelogin/schemas ` is now ` lib/ruby_saml/schemas ` .
3535
3636For backward compatibility, the alias ` OneLogin = Object ` has been set, so ` OneLogin::RubySaml:: ` will still work
37- as before. This alias will be removed in RubySaml version ` 2.1 .0` .
37+ as before. This alias will be removed in RubySaml version ` 3.0 .0` .
3838
3939### Deprecation and removal of "XMLSecurity" namespace
4040
@@ -74,24 +74,33 @@ settings.security[:signature_method] = RubySaml::XML::RSA_SHA1
7474### Replacement of REXML with Nokogiri
7575
7676RubySaml ` 1.x ` used a combination of REXML and Nokogiri for XML parsing and generation.
77- In ` 2.0.0 ` , REXML has been replaced with Nokogiri. This change should be transparent
78- to most users, however, see note about Custom Metadata Fields below.
77+ In ` 2.0.0 ` , REXML has been replaced with Nokogiri. As a result, there are minor differences
78+ in how XML is generated, ncluding SAML requests and SP Metadata:
79+
80+ 1 . All XML namespace declarations will be on the root node of the XML. Previously,
81+ some declarations such as ` xmlns:ds ` were done on child nodes.
82+ 2 . The ordering of attributes on each node may be different.
83+
84+ These differences should not affect how the XML is parsed by various XML parsing libraries.
85+ However, if you are strictly asserting that the generated XML is an exact string in your tests,
86+ such tests may need to be adjusted accordingly.
7987
8088### Custom Metadata Fields now use Nokogiri XML Builder
8189
8290If you have added custom fields to your SP metadata generation by overriding
83- the ` RubySaml::Metadata#add_extras ` method, you will need to update your code to use
84- [ Nokogiri::XML::Builder] ( https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html ) format
85- instead of REXML. Here is an example of the new format:
91+ the ` RubySaml::Metadata#add_extras ` method, you will need to update your code
92+ so that the first arg of the method is a
93+ [ Nokogiri::XML::Builder] ( https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html )
94+ object. Here is an example of the new format:
8695
8796``` ruby
8897class MyMetadata < RubySaml ::Metadata
8998 private
9099
91- def add_extras (xml , _settings )
92- xml[ ' md ' ] .ContactPerson (' contactType' => ' technical' ) do
93- xml[ ' md ' ] .GivenName ( ' ACME SAML Team' )
94- xml[ ' md ' ] .EmailAddress ( ' saml@acme.com' )
100+ def add_extras (builder , _settings )
101+ builder .ContactPerson (' contactType' => ' technical' ) do
102+ builder .GivenName { builder.text ' ACME SAML Team' }
103+ builder .EmailAddress { builder.text ' saml@acme.com' }
95104 end
96105 end
97106end
101110
102111RubySaml now always uses double quotes for attribute values when generating XML.
103112The ` settings.double_quote_xml_attribute_values ` parameter now always behaves as ` true ` ,
104- and will be removed in RubySaml 2.1 .0.
113+ and will be removed in RubySaml 3.0 .0.
105114
106115The reasons for this change are:
107116- RubySaml will use Nokogiri instead of REXML to generate XML. Nokogiri does not support
@@ -154,7 +163,7 @@ a different `sp_uuid_prefix` is passed-in on subsequent calls.
154163### Deprecation of compression settings
155164
156165The ` settings.compress_request ` and ` settings.compress_response ` parameters have been deprecated
157- and are no longer functional. They will be removed in RubySaml 2.1 .0. Please remove ` compress_request `
166+ and are no longer functional. They will be removed in RubySaml 3.0 .0. Please remove ` compress_request `
158167and ` compress_response ` everywhere within your project code.
159168
160169The SAML SP request/response message compression behavior is now controlled automatically by the
@@ -166,13 +175,15 @@ compression may be achieved by enabling `Content-Encoding: gzip` on your webserv
166175### Deprecation of IdP certificate fingerprint settings
167176
168177The ` settings.idp_cert_fingerprint ` and ` settings.idp_cert_fingerprint_algorithm ` are deprecated
169- and will be removed in RubySaml 2.1.0. Please use ` settings.idp_cert ` or ` settings.idp_cert_multi ` instead.
170- The reasons for this deprecation are that (1) fingerprint cannot be used with HTTP-Redirect binding,
171- and (2) fingerprint is theoretically susceptible to collision attacks.
178+ and will be removed in RubySaml 3.0.0. Please use ` settings.idp_cert ` or ` settings.idp_cert_multi ` instead.
179+
180+ The reasons for this deprecation are:
181+ - Fingerprint cannot be used with HTTP-Redirect binding
182+ - Fingerprint is theoretically susceptible to collision attacks.
172183
173184### Other settings deprecations
174185
175- The following parameters in ` RubySaml::Settings ` are deprecated and will be removed in RubySaml 2.1 .0:
186+ The following parameters in ` RubySaml::Settings ` are deprecated and will be removed in RubySaml 3.0 .0:
176187
177188- ` #issuer ` is deprecated and replaced 1:1 by ` #sp_entity_id `
178189- ` #idp_sso_target_url ` is deprecated and replaced 1:1 by ` #idp_sso_service_url `
@@ -212,7 +223,7 @@ and `#format_private_key` methods. Specifically:
212223 stripped out.
213224- Case 7: If no valid certificates are found, the entire original string will be returned.
214225
215- ## Updating from 1.17.x to 1.18.0
226+ ## Upgrading from 1.17.x to 1.18.0
216227
217228Version ` 1.18.0 ` changes the way the toolkit validates SAML signatures. There is a new order
218229how validation happens in the toolkit and also the toolkit by default will check malformed doc
@@ -222,7 +233,7 @@ The SignedDocument class defined at xml_security.rb experienced several changes.
222233We don't expect compatibilty issues if you use the main methods offered by ruby-saml, but if
223234you use a fork or customized usage, is possible that you need to adapt your code.
224235
225- ## Updating from 1.12.x to 1.13.0
236+ ## Upgrading from 1.12.x to 1.13.0
226237
227238Version ` 1.13.0 ` adds ` settings.idp_sso_service_binding ` and ` settings.idp_slo_service_binding ` , and
228239deprecates ` settings.security[:embed_sign] ` . If specified, new binding parameters will be used in place of ` :embed_sign `
0 commit comments