Skip to content
Snippets Groups Projects
Commit 90a7f9bb authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Merge pull request #2151 from zaach/issue2016_more_verifier_failure_metrics

Log additional verifier assertion errors, where assertion or audience could not be found.

r+

@zaach - thanks for the update, looks good.
parents 82075abd fd04d978
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment