Method: Saml::Bindings::HTTPPost.create_form_attributes

Defined in:
lib/saml/bindings/http_post.rb

.create_form_attributes(message, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/saml/bindings/http_post.rb', line 7

def create_form_attributes(message, options = {})
  param = message.is_a?(Saml::ComplexTypes::StatusResponseType) ? "SAMLResponse" : "SAMLRequest"

  xml = if options[:skip_signature]
    message.to_xml
  else
    Saml::Util.sign_xml(message)
  end
  notify('create_message', xml)

  variables        = {}
  variables[param] = Saml::Encoding.encode_64(xml)
  variables["RelayState"] = options[:relay_state] if options[:relay_state]

  {
      location:  message.destination,
      variables: variables
  }
end