tweaked what's returned for grant requests
This commit is contained in:
parent
c0ad5f19fc
commit
ddf461a054
@ -111,6 +111,7 @@ public keys associated with the correct user when retrieving JWKs.
|
||||
* **Body Params**
|
||||
* `sub`: The [subject](#subject) using `azp` from the url
|
||||
* `scope`: A comma separated list of the permissions granted
|
||||
* **Response**: The same object returned when retrieving single grants
|
||||
|
||||
### Retrieving Grants ###
|
||||
* **URL** `:scheme//:hostname/api/issuer@oauth3.org/grants/:sub/:azp`
|
||||
@ -121,6 +122,7 @@ public keys associated with the correct user when retrieving JWKs.
|
||||
* **Response**
|
||||
* `sub`: The same `sub` from the url
|
||||
* `azp`: The same `azp` from the url
|
||||
* `azpSub`: The `sub` for the `azp`
|
||||
* `scope`: A comma separated list of the permissions granted
|
||||
* `updatedAt`: The ms timestamp for the most recent change to the grants
|
||||
|
||||
|
@ -10,7 +10,7 @@ function trim(grant) {
|
||||
return {
|
||||
sub: grant.sub,
|
||||
azp: grant.azp,
|
||||
// azpSub: grant.azpSub,
|
||||
azpSub: grant.azpSub,
|
||||
scope: grant.scope,
|
||||
updatedAt: parseInt(grant.updatedAt, 10),
|
||||
};
|
||||
@ -74,7 +74,12 @@ function create(app) {
|
||||
};
|
||||
return req.Store.upsert(grant.sub+'/'+grant.azp, grant);
|
||||
}).then(function () {
|
||||
return {success: true};
|
||||
return req.Store.get(req.params.sub+'/'+req.params.azp);
|
||||
}).then(function (grant) {
|
||||
if (!grant) {
|
||||
throw new Error('failed to retrieve grants after saving them');
|
||||
}
|
||||
return trim(grant);
|
||||
});
|
||||
|
||||
app.handlePromise(req, res, promise, '[issuer@oauth3.org] save grants');
|
||||
|
Loading…
x
Reference in New Issue
Block a user