feat: implement OIDC SSO with JIT provisioning

This commit is contained in:
Trevor Mears
2026-01-17 22:52:06 -08:00
parent 82b93602c1
commit 5752f529cb
8 changed files with 273 additions and 39 deletions
+14 -1
View File
@@ -365,6 +365,16 @@ const users = {
return db.users?.find(u => u.username === username);
},
async getByOidcId(oidcId) {
const db = await loadDb();
return db.users?.find(u => u.oidcId === oidcId);
},
async getByEmail(email) {
const db = await loadDb();
return db.users?.find(u => u.email === email);
},
async create(userData) {
const db = await loadDb();
if (!db.users) {
@@ -379,8 +389,11 @@ const users = {
const newUser = {
id: db.nextId++,
username: userData.username,
passwordHash: userData.passwordHash,
// For OIDC users, passwordHash is optional
passwordHash: userData.passwordHash || null,
role: userData.role || 'viewer',
oidcId: userData.oidcId || null,
email: userData.email || null,
createdAt: new Date().toISOString()
};