This commit is contained in:
Marcin Czop 2025-06-29 13:43:10 +02:00
parent 6986ab1ec5
commit 101efa2605

View file

@ -28,6 +28,20 @@ const oidcClaimsHook = async (orig: OidcAuth | undefined, claims: IDToken | unde
}; };
}; };
app.get("/auth/logout", async (c) => {
const auth = await getAuth(c);
if (!auth) {
return c.json({ status: 401, message: "Unauthorized" }, 401);
}
await revokeSession(c);
return c.json({ status: 200, message: "OK" });
});
app.get("/auth/login", async (c) => {
const auth = await getAuth(c);
return c.json({ status: 200, message: "OK", data: auth });
});
app.get("/auth/callback", async (c: Context) => { app.get("/auth/callback", async (c: Context) => {
c.set("oidcClaimsHook", oidcClaimsHook); c.set("oidcClaimsHook", oidcClaimsHook);
return processOAuthCallback(c); return processOAuthCallback(c);
@ -44,20 +58,6 @@ app.use("/auth/*", async (c, next) => {
await next(); await next();
}); });
app.get("/auth/logout", async (c) => {
const auth = await getAuth(c);
if (!auth) {
return c.json({ status: 401, message: "Unauthorized" }, 401);
}
await revokeSession(c);
return c.json({ status: 200, message: "OK" });
});
app.get("/auth/login", async (c) => {
const auth = await getAuth(c);
return c.json({ status: 200, message: "OK", data: auth });
});
app.route("/", api); app.route("/", api);
app.get("/stats", async (c) => { app.get("/stats", async (c) => {