Module: caf_security/rules

Basic authorization rules.

Source:

Methods

computeRuleId(rule) → {string}

Computes a content-based identifier for a simple rule.

Parameters:
Name Type Description
rule ruleType

A simple rule.

Source:
Throws:

Invalid rule.

Type
Error
Returns:

A unique identifier based on the contents of that rule.

Type
string

isAuthorized(caOwner, caLocalName, method, rE) → {boolean}

Checks whether a CA is authorized to make a method call.

Parameters:
Name Type Description
caOwner string

The owner of the calling CA.

caLocalName string

The local name of the calling CA.

method string

A method to authorize.

rE ruleEngineType

A trie based data structure to speed up checks.

Source:
Returns:

True if authorized.

Type
boolean

newRuleEngine(meOwner, meLocalName, rules) → {ruleEngineType}

Preprocess an array of rules for quick authorization checks using a trie based data structure.

Parameters:
Name Type Description
meOwner string

The owner of the target CA.

meLocalName string

The local name of the target CA.

rules Array.<ruleType>

A set of rules to pre-process.

Source:
Returns:

A trie based data structure to speed up checks.

Type
ruleEngineType

newSimpleRule(methodsopt, caOwneropt, caLocalNameopt) → {ruleType}

Constructor for a simple rule.

Parameters:
Name Type Attributes Description
methods Array.<string> | string <optional>

Methods to enable.

caOwner string <optional>

Owner of the calling CA.

caLocalName string <optional>

Local name of the calling CA/

Source:
See:
Returns:

An authorization rule.

Type
ruleType