diff --git a/packages/ucp/docs/uconRuleStore.md b/packages/ucp/docs/uconRuleStore.md index c7fb719..bb253a4 100644 --- a/packages/ucp/docs/uconRuleStore.md +++ b/packages/ucp/docs/uconRuleStore.md @@ -1 +1,55 @@ -TODO: why do we have multiple storages for this \ No newline at end of file +# Usage Control Rule Storage + +## Abstraction + +There is an abstraction provided such that multiple implementations for a storage can provided. +This abstraction is given by the interface `UCRulesStorage` : + +```ts +interface UCRulesStorage { + getStore: () => Promise; + + addRule: (rule: Store) => Promise; + + getRule: (identifier: string) => Promise; + + deleteRule: (identifier: string) => Promise; +} +``` + +Multiple implementations allow for having a dynamic storage. +In the Usage Control Decision engine implementation (`UcpPatternEnforcement`) of `UconEnforcementDecision`, an `UCRulesStorage` is provided, such that when used in a server (such as an Authorization Server (AS) as defined by the UMA protocol) the rule set can be changed dynamically. This allows for requests to be immediately evaluated against the new rule set. + + +Why does it use an N3 store and not `UCPPolicy` interface. Because the uconEgine implementation is built to work with RDF an not with a Typescript interface (see the N3 rules). + + + +## Different implementations + +### Memory based + +Allows for manipulation of the set of Usage Control Rules without requiring a physical storage. +A disadvantage is that if this type of `UCRulesStorage` would be used in production, all the rules would be gone after exiting the program. + + + +### LDP Container based + +Allows to use a Linked Data Platform (LDP) Container as a storage for the Usage Control Rules. +Other systems can then use LDP operations to add or delete Usage Control Rules. + +Since LDP uses HTTP to transfer data, this might be slower than the other options. + +An advantage is that when the this type of `UCRulesStorage` would be used in production, all the rules would still be there after exiting the program. + + + +### Directory based + +Allows to use a directory as a storage for the Usage Control Rules. +Other systems can then use IO operations to the directory to add or delete Usage Control Rules. + +An advantage is that when the this type of `UCRulesStorage` would be used in production, all the rules would still be there after exiting the program. + +