mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-19 19:21:12 +10:00
20 lines
617 B
TypeScript
20 lines
617 B
TypeScript
import { AuthMec } from "~~/prisma/client/enums";
|
|
import aclManager from "~~/server/internal/acls";
|
|
import authManager from "~~/server/internal/auth";
|
|
|
|
export default defineEventHandler(async (h3) => {
|
|
const allowed = await aclManager.allowSystemACL(h3, ["auth:read", "setup"]);
|
|
if (!allowed) throw createError({ statusCode: 403 });
|
|
|
|
const enabledAuthManagers = authManager.getAuthProviders();
|
|
|
|
const authData = {
|
|
[AuthMec.Simple]: enabledAuthManagers.Simple,
|
|
[AuthMec.OpenID]:
|
|
enabledAuthManagers.OpenID &&
|
|
enabledAuthManagers.OpenID.generateConfiguration(),
|
|
};
|
|
|
|
return authData;
|
|
});
|