       saml_response = null
       decrypted_assertion = null
 
-      user = {}
+      response = {}
 
       async.waterfall [
         (cb_wf) ->

    .object()
    .value()

module.exports.ServiceProvider =
  class ServiceProvider
    constructor: (@issuer, @private_key, @certificate) ->

          if (get_request)
            return zlib.inflateRaw raw, cb_wf
          setImmediate cb_wf, null, raw
        (response_buffer, cb_wf) ->
          saml_response = (new xmldom.DOMParser()).parseFromString(response_buffer.toString())
          async.lift(parse_response_header) saml_response, cb_wf
        (response_header, cb_wf) =>
          response = { response_header }
          cb_wf new Error("SAML Response was not success!") unless check_status_success(saml_response)
          switch
            when saml_response.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'Response').length is 1
              response.type = 'authn_response'
              parse_authn_response saml_response, @private_key, identity_provider.certificate, cb_wf
            when saml_response.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'LogoutResponse').length is 1
              response.type = 'logout_response'
              setImmediate cb_wf, null, {}
        (result, cb_wf) ->
          _.extend response, result
          cb_wf null, response
      ], cb

    # -- Optional
