lib/saml/kit/bindings/url_builder.rb in saml-kit-1.0.14 vs lib/saml/kit/bindings/url_builder.rb in saml-kit-1.0.15

- old
+ new

@@ -1,28 +1,34 @@ # frozen_string_literal: true module Saml module Kit module Bindings + # This class is responsible for + # generating a url as per the + # rules for the HTTP redirect binding + # specification. + # https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf # {include:file:spec/saml/kit/bindings/url_builder_spec.rb} class UrlBuilder include Serializable attr_reader :configuration def initialize(configuration: Saml::Kit.configuration) @configuration = configuration end def build(saml_document, relay_state: nil) + destination = saml_document.destination if configuration.sign? payload = canonicalize(saml_document, relay_state) - "#{saml_document.destination}?#{payload}&Signature=#{signature_for(payload)}" + "#{destination}?#{payload}&Signature=#{signature_for(payload)}" else payload = to_query_string( saml_document.query_string_parameter => serialize(saml_document.to_xml), 'RelayState' => relay_state ) - "#{saml_document.destination}?#{payload}" + "#{destination}?#{payload}" end end private