oidc: inline the findAccount
This commit is contained in:
16
src/oidc.js
16
src/oidc.js
@@ -631,7 +631,7 @@ async function interactionAbort(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
async function claims(userId/*, use, scope*/) {
|
||||
async function getClaims(userId/*, use, scope*/) {
|
||||
const [error, user] = await safe(users.get(userId));
|
||||
if (error) return { error: 'user not found' };
|
||||
|
||||
@@ -661,13 +661,6 @@ async function claims(userId/*, use, scope*/) {
|
||||
return claims;
|
||||
}
|
||||
|
||||
async function findAccount(ctx, id) {
|
||||
return {
|
||||
accountId: id,
|
||||
async claims(use, scope) { return await claims(id, use, scope); },
|
||||
};
|
||||
}
|
||||
|
||||
async function renderError(ctx, out, error) {
|
||||
const data = {
|
||||
ICON_URL: '/api/v1/cloudron/avatar',
|
||||
@@ -728,7 +721,12 @@ async function start() {
|
||||
}
|
||||
|
||||
const configuration = {
|
||||
findAccount,
|
||||
findAccount: async function(ctx, id) {
|
||||
return {
|
||||
accountId: id,
|
||||
claims: async (use, scope) => await getClaims(id, use, scope)
|
||||
};
|
||||
},
|
||||
renderError,
|
||||
adapter: StorageAdapter,
|
||||
interactions: {
|
||||
|
||||
Reference in New Issue
Block a user