 _             = require 'underscore'
 async         = _.extend require('async'), require('async-ext')
 crypto        = require 'crypto'
+debug         = require('debug') 'saml2'
 {parseString} = require 'xml2js'
 url           = require 'url'
 util          = require 'util'

    (cb_wf) ->
      decrypt_assertion saml_response, sp_private_key, cb_wf
    (result, cb_wf) ->
      decrypted_assertion = (new xmldom.DOMParser()).parseFromString(result)
      unless _.some(idp_certificates, (cert) -> check_saml_signature result, cert)
        return cb_wf new Error("SAML Assertion signature check failed! (checked #{idp_certificates.length} certificate(s))")

            return zlib.inflateRaw raw, cb_wf
          setImmediate cb_wf, null, raw
        (response_buffer, cb_wf) ->
          debug saml_response
          saml_response = (new xmldom.DOMParser()).parseFromString(response_buffer.toString())
          async.lift(parse_response_header) saml_response, cb_wf
        (response_header, cb_wf) =>
