Class: Saml::Bindings::HTTPPost

Inherits:
Object
  • Object
show all
Includes:
Notification
Defined in:
lib/saml/bindings/http_post.rb

Class Method Summary collapse

Methods included from Notification

#notify

Class Method Details

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



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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 = notify('create_message', Saml::Util.sign_xml(message))

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

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

.receive_message(request, type) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/saml/bindings/http_post.rb', line 22

def receive_message(request, type)
  message             = Saml::Encoding.decode_64(request.params["SAMLRequest"] || request.params["SAMLResponse"])
  notify('receive_message', message)
  request_or_response = Saml.parse_message(message, type)

  verified_request_or_response = Saml::Util.verify_xml(request_or_response, message)
  verified_request_or_response.actual_destination = request.url
  verified_request_or_response
end