36 lines
923 B
JavaScript
36 lines
923 B
JavaScript
import { getConfig } from "../../common/config.js";
|
|
|
|
let evaluator;
|
|
|
|
export async function loadPep(app) {
|
|
const config = getConfig();
|
|
if (config.pdpType) {
|
|
const pepModulePath = `./${config.pdpType}.js`;
|
|
const { init, check } = await import(pepModulePath);
|
|
await init();
|
|
|
|
// // Follow AuthZEN base format
|
|
// // {
|
|
// // subject: {
|
|
// // type: "user",
|
|
// // id: "1abc",
|
|
// // },
|
|
// // action: {
|
|
// // name: "read"
|
|
// // },
|
|
// // resource: {
|
|
// // type: "data",
|
|
// // id: "2def",
|
|
// // properties: {
|
|
// // ownerID: "my@me.com"
|
|
// // }
|
|
// // }
|
|
// // }
|
|
evaluator = check;
|
|
}
|
|
}
|
|
|
|
export async function evaluate(req) {
|
|
return await evaluator(req);
|
|
}
|