 
       async.waterfall [
         (cb_wf) ->
-          raw = new Buffer(request_body.SAMLResponse, 'base64')
+          raw = new Buffer(request_body.SAMLResponse || request_body.SAMLRequest, 'base64')
           # For GET requests, it's necessary to inflate the response before parsing it.
           if (get_request)
             return zlib.inflateRaw raw, cb_wf


    # -- Optional
    # Returns a redirect URL, at which a user is logged out.
    create_logout_url: (identity_provider, name_id, session_index, cb) =>
      xml = create_logout_request @issuer, name_id, session_index, identity_provider.sso_logout_url
      zlib.deflateRaw xml, (err, deflated) =>
        return cb err if err?
        uri = url.parse identity_provider.sso_logout_url
        uri.query = sign_get_request deflated.toString('base64'), @private_key
        cb null, url.format(uri)

    # Returns XML metadata, used during initial SAML configuration
    create_metadata: (assert_endpoint) =>

# InResponseTo attributes of the Response if present. It will throw an error if the Response is missing or does not
# appear to be valid.
parse_response_header = (dom) ->
  for response_type in ['Response', 'LogoutResponse', 'LogoutRequest']
    response = dom.getElementsByTagNameNS(XMLNS.SAMLP, response_type)
    break if response.length > 0
  throw new Error("Expected 1 Response; found #{response.length}") unless response.length is 1
