diff --git a/bin/verifier b/bin/verifier index b891002b1d9f13d062fc495212b8adc37035124d..0999750fbb1d5b870022604c61f11d1f442941a1 100755 --- a/bin/verifier +++ b/bin/verifier @@ -81,14 +81,27 @@ function doVerification(req, resp, next) { if (!(assertion && audience)) { // why couldn't we extract these guys? Is it because the request parameters weren't encoded as we expect? GH-643 const want_ct = [ 'application/x-www-form-urlencoded', 'application/json' ]; + var reason; try { var ct = req.headers['content-type']; if (ct.indexOf(';') != -1) ct = ct.substr(0, ct.indexOf(';')); if (want_ct.indexOf(ct) == -1) throw "wrong content type"; } catch (e) { - return resp.json({ status: "failure", reason: "Content-Type expected to be one of: " + want_ct.join(", ") }, 415); + reason = "Content-Type expected to be one of: " + want_ct.join(", "); + metrics.report('verify', { + result: 'failure', + reason: reason, + rp: audience + }); + return resp.json({ status: "failure", reason: reason}, 415); } - return resp.json({ status: "failure", reason: "need assertion and audience"}, 400); + reason = "need assertion and audience"; + metrics.report('verify', { + result: 'failure', + reason: reason, + rp: audience + }); + return resp.json({ status: "failure", reason: reason}, 400); } var startTime = new Date();