           response = { response_header }
           cb_wf new Error("SAML Response was not success!") unless check_status_success(saml_response)
           switch
-            when saml_response.getElementsByTagNameNS(xmlns.samlp, 'Response').length is 1
+            when saml_response.getElementsByTagNameNS(XMLNS.SAMLP, 'Response').length is 1
               response.type = 'authn_response'
               parse_authn_response saml_response, @private_key, identity_provider.certificate, cb_wf
-            when saml_response.getElementsByTagNameNS(xmlns.samlp, 'LogoutResponse').length is 1
+            when saml_response.getElementsByTagNameNS(XMLNS.SAMLP, 'LogoutResponse').length is 1
               response.type = 'logout_response'
               setImmediate cb_wf, null, {}
         (result, cb_wf) ->

  {
    '@use': use
    'ds:KeyInfo':
      '@xmlns:ds': xmlns.ds
      'ds:X509Data':
        'ds:X509Certificate':
          cert_data.replace(/[\r\n|\n]/g, '')

# Takes in an xml @dom of an object containing a SAML Assertion and returns the SessionIndex. It will throw an error
# if there is no SessionIndex, no Assertion, or the Assertion does not appear to be valid.
get_session_index = (dom) ->
  assertion = dom.getElementsByTagNameNS(XMLNS.SAML, 'Assertion')
  throw new Error("Expected 1 Assertion; found #{assertion.length}") unless assertion.length is 1

  authn_statement = assertion[0].getElementsByTagNameNS(XMLNS.SAML, 'AuthnStatement')
  throw new Error("Expected 1 AuthnStatement; found #{authn_statement.length}") unless authn_statement.length is 1

  for attr in authn_statement[0].attributes
