Skip to content

Commit

Permalink
Merge pull request Clever#11 from Clever/debug-logging
Browse files Browse the repository at this point in the history
add debug. print saml XML response string before/after decryption.
  • Loading branch information
nathanleiby committed Aug 7, 2014
2 parents 819d086 + a3725c1 commit eaae6e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/saml2.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
_ = 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'
Expand Down Expand Up @@ -264,6 +265,7 @@ parse_authn_response = (saml_response, sp_private_key, idp_certificates, cb) ->
(cb_wf) ->
decrypt_assertion saml_response, sp_private_key, cb_wf
(result, cb_wf) ->
debug result
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))")
Expand Down Expand Up @@ -316,6 +318,7 @@ module.exports.ServiceProvider =
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) =>
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
"coffee-script": "~1.7.1"
},
"dependencies": {
"async": "~0.2.10",
"async-ext": "~0.1.4",
"debug": "^1.0.4",
"underscore": "~1.6.0",
"xml2js": "~0.4.1",
"xmlbuilder": "~2.1.0",
"xml-crypto": "0.0.22",
"xmldom": "~0.1.19",
"xml-encryption": "~0.6.0",
"async": "~0.2.10",
"async-ext": "~0.1.4"
"xml2js": "~0.4.1",
"xmlbuilder": "~2.1.0",
"xmldom": "~0.1.19"
}
}

0 comments on commit eaae6e0

Please sign in to comment.