mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
homepage-plus
This commit is contained in:
parent
6b4182ab96
commit
7453754b36
16 changed files with 262 additions and 52 deletions
17
src/pages/api/auth.js
Normal file
17
src/pages/api/auth.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { checkAllowedGroup, readIdentitySettings } from "utils/identity/identity-helpers";
|
||||
import { getSettings } from "utils/config/config";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const { group } = req.query;
|
||||
const { provider, groups } = readIdentitySettings(getSettings().identity);
|
||||
|
||||
try {
|
||||
if (checkAllowedGroup(provider.getIdentity(req), groups, group)) {
|
||||
res.json({ group });
|
||||
} else {
|
||||
res.status(401).json({ message: "Group unathorized" });
|
||||
}
|
||||
} catch (err) {
|
||||
res.status(500).send("Error getting user identity");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue