oidc: use better json based file store for objects
This commit is contained in:
@@ -17,7 +17,7 @@ exports = module.exports = {
|
||||
mailserver: require('./mailserver.js'),
|
||||
network: require('./network.js'),
|
||||
notifications: require('./notifications.js'),
|
||||
oidcclients: require('./oidcclients.js'),
|
||||
oidc: require('./oidc.js'),
|
||||
profile: require('./profile.js'),
|
||||
provision: require('./provision.js'),
|
||||
services: require('./services.js'),
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
get,
|
||||
list,
|
||||
add,
|
||||
update,
|
||||
remove
|
||||
clients: {
|
||||
get,
|
||||
list,
|
||||
add,
|
||||
update,
|
||||
del
|
||||
},
|
||||
|
||||
destroyUserSession
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -78,7 +82,7 @@ async function list(req, res, next) {
|
||||
next(new HttpSuccess(200, { clients: result }));
|
||||
}
|
||||
|
||||
async function remove(req, res, next) {
|
||||
async function del(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.clientId, 'string');
|
||||
|
||||
const [error] = await safe(oidc.clients.del(req.params.clientId));
|
||||
@@ -86,3 +90,12 @@ async function remove(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
|
||||
async function destroyUserSession(req, res, next) {
|
||||
assert.strictEqual(typeof req.user, 'object');
|
||||
|
||||
const [error] = await safe(oidc.revokeByUserId(req.user.id));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
Reference in New Issue
Block a user