class Saml::Bindings::SOAP

Constants

SOAP_ACTION

Public Class Methods

create_response_xml(response) click to toggle source
# File lib/saml/bindings/soap.rb, line 10
def create_response_xml(response)
  notify('create_response', Saml::Util.sign_xml(response, :soap))
end
post_message(message, response_type) click to toggle source
# File lib/saml/bindings/soap.rb, line 14
def post_message(message, response_type)
  signed_message = notify('create_post', Saml::Util.sign_xml(message, :soap))

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

  if http_response.code == "200"
    response = notify('receive_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) click to toggle source
# File lib/saml/bindings/soap.rb, line 27
def receive_message(request, type)
  raw_xml = request.body.dup.read
  notify('receive_message', raw_xml)
  message = Saml.parse_message(raw_xml, type)

  skip_signature_verification = (
    message.is_a?(Saml::AuthnRequest) &&
    !message.provider.authn_requests_signed?
  )

  if skip_signature_verification
    message
  else
    Saml::Util.verify_xml(message, raw_xml)
  end
end