From 1ea76ebb6048a80d2c542094de83f170079b6ac4 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 9 Mar 2023 19:16:36 +0100 Subject: [PATCH] oidc: add initial findAccount and fixup findByUid --- src/oidc.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/oidc.js b/src/oidc.js index 29ad10196..85fcd4419 100644 --- a/src/oidc.js +++ b/src/oidc.js @@ -106,7 +106,7 @@ class CloudronAdapter { debug(`[${this.name}] findByUid uid:${uid}`); for (let d in this.store) { - if (this.store[d].uid === uid) return this.store[d].payload; + if (this.store[d].payload.uid === uid) return this.store[d].payload; } return false; @@ -171,6 +171,14 @@ async function getProvider() { const { Provider } = await import('oidc-provider'); const configuration = { + async findAccount(ctx, id) { + debug(`findAccount ctx:${ctx} id:${id}`); + + return { + accountId: id, + async claims(use, scope) { return { sub: id }; }, + }; + }, adapter: CloudronAdapter, clients: [{ client_id: 'foo',