Skip to content

Commit 1c5ea5a

Browse files
committed
fix: Allow configuration of eye reasoner path
1 parent ccb8c8c commit 1c5ea5a

7 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/uma/bin/demo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const launch: () => Promise<void> = async () => {
2020

2121
// variables['urn:uma:variables:policyDir'] = path.join(rootDir, './config/rules/policy');
2222
variables['urn:uma:variables:rulesDir'] = path.join(rootDir, './config/rules/n3');
23+
variables['urn:uma:variables:eyePath'] = 'eye';
2324

2425
variables['urn:uma:variables:mainModulePath'] = rootDir;
2526
variables['urn:uma:variables:customConfigPath'] = path.join(rootDir, './config/demo.json');

packages/uma/bin/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const launch: () => Promise<void> = async () => {
2020

2121
variables['urn:uma:variables:policyDir'] = path.join(rootDir, './config/rules/policy');
2222
variables['urn:uma:variables:rulesDir'] = path.join(rootDir, './config/rules/n3');
23+
variables['urn:uma:variables:eyePath'] = 'eye';
2324

2425
variables['urn:uma:variables:mainModulePath'] = rootDir;
2526
variables['urn:uma:variables:customConfigPath'] = path.join(rootDir, './config/default.json');

packages/uma/bin/odrl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const launch: () => Promise<void> = async () => {
2020

2121
variables['urn:uma:variables:policyDir'] = path.join(rootDir, './config/rules/odrl');
2222
// variables['urn:uma:variables:rulesDir'] = path.join(rootDir, './config/rules/n3');
23+
variables['urn:uma:variables:eyePath'] = 'eye';
2324

2425
variables['urn:uma:variables:mainModulePath'] = rootDir;
2526
variables['urn:uma:variables:customConfigPath'] = path.join(rootDir, './config/odrl.json');

packages/uma/config/policies/authorizers/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"fallback": {
5252
"@id": "urn:uma:default:OdrlAuthorizer",
5353
"@type": "OdrlAuthorizer",
54+
"eyePath": { "@id": "urn:uma:variables:eyePath" },
5455
"policies": {
5556
"@id": "urn:uma:default:RulesStorage",
5657
"@type": "DirectoryUCRulesStorage",

packages/uma/config/policies/authorizers/odrl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{
88
"@id": "urn:uma:default:Authorizer",
99
"@type": "OdrlAuthorizer",
10+
"eyePath": { "@id": "urn:uma:variables:eyePath" },
1011
"policies": {
1112
"@id": "urn:uma:default:RulesStorage",
1213
"@type": "DirectoryUCRulesStorage",

packages/uma/config/variables/default.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"comment": "Path to the directory containing the N3 rules.",
2727
"@id": "urn:uma:variables:rulesDir",
2828
"@type": "Variable"
29+
},
30+
{
31+
"comment": "Path of the local eye reasoner.",
32+
"@id": "urn:uma:variables:eyePath",
33+
"@type": "Variable"
2934
}
3035
]
3136
}

packages/uma/src/policies/authorizers/OdrlAuthorizer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ export class OdrlAuthorizer implements Authorizer {
3838
*/
3939
constructor(
4040
private readonly policies: UCRulesStorage,
41+
private readonly eyePath?: string,
4142
) {
42-
const engine = new ODRLEngineMultipleSteps(new EyeReasoner('/usr/local/bin/eye', ["--quiet", "--nope", "--pass-only-new"]));
43-
// const engine = new ODRLEngineMultipleSteps();
43+
const engine = eyePath ?
44+
new ODRLEngineMultipleSteps(new EyeReasoner(eyePath, ["--quiet", "--nope", "--pass-only-new"])) :
45+
new ODRLEngineMultipleSteps();
4446
this.odrlEvaluator = new ODRLEvaluator(engine);
4547
}
4648

0 commit comments

Comments
 (0)