From ef43b56f1f459a31339a4bf50c9ead1850708bc4 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Wed, 19 Jul 2017 15:27:19 -0600 Subject: [PATCH] allow grants to be updated --- rest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rest.js b/rest.js index 68be741..b4c9408 100644 --- a/rest.js +++ b/rest.js @@ -186,7 +186,11 @@ module.exports.create = function (bigconf, deps, app) { return req.Store.find({ azpSub: req.body.sub }); }).then(function (existing) { if (existing.length) { - throw new Error("PPID collision detected, cannot save authorized party's sub"); + if (existing.length > 1) { + throw new Error("pre-existing PPID collision detected"); + } else if (existing[0].sub !== req.params.sub || existing[0].azp !== req.params.azp) { + throw new Error("PPID collision detected, cannot save authorized party's sub"); + } } var grant = {