Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
return status:1 if not oidc
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Jan 6, 2024
1 parent 63fd15c commit 028dfa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const app = new Hono();
app.use("*", logger());

app.post("/prelogin", async (c) => {
const payload = await c.req.json();
console.debug("req", c.req.url, payload);

if (c.req.query("protocol") === "OIDC") {
const payload = await c.req.json();

const username = payload.username;
const groups = payload.oidc_custom_fields.groups.map((g: string) => ({
name: g.slice(1).replace("discord-", ""),
type: 2,
}));

const user = {
status: 1,
username,
Expand All @@ -24,9 +24,10 @@ app.post("/prelogin", async (c) => {
},
};
console.log("oidc", user);

return c.json(user);
} else {
return c.json(payload);
return c.json({ status: 1 });
}
});

Expand Down

0 comments on commit 028dfa6

Please sign in to comment.