Class: Saml::Bindings::SOAP

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/bindings/soap.rb

Constant Summary collapse

SOAP_ACTION =
'http://www.oasis-open.org/committees/security'

Class Method Summary collapse

Class Method Details

.create_response_xml(response) ⇒ Object



8
9
10
# File 'lib/saml/bindings/soap.rb', line 8

def create_response_xml(response)
  Saml::Util.sign_xml(response, :soap)
end

.post_message(message, response_type) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/saml/bindings/soap.rb', line 12

def post_message(message, response_type)
  signed_message = Saml::Util.sign_xml(message, :soap)

  http_response = Saml::Util.post(message.destination, signed_message, { 'SOAPAction' => SOAP_ACTION } )

  if http_response.code == "200"
    response = Saml.parse_message(http_response.body, response_type)
    Saml::Util.verify_xml(response, http_response.body)
  else
    nil
  end
end

.receive_message(request, type) ⇒ Object



25
26
27
28
29
30
# File 'lib/saml/bindings/soap.rb', line 25

def receive_message(request, type)
  raw_xml = request.body.dup.read
  message = Saml.parse_message(raw_xml, type)

  Saml::Util.verify_xml(message, raw_xml)
end