heimdall.auth package
Submodules
heimdall.auth.policy_enforcement_provider module
- class heimdall.auth.policy_enforcement_provider.PolicyEnforcementProvider(version: str, id: str, name: str, description: str, atoms: List[AuthorizationAtom] = None)[source]
Bases:
BaseModel
- add_atom(atom: AuthorizationAtom)[source]
Adds an authorization atom to this policy enforcement provider.
- Parameters:
atom (AuthorizationAtom) – The authorization atom to add.
- authorization_atoms: List[AuthorizationAtom]
- description: str
- export(file_path: str)[source]
Exports this policy enforcement provider to a file.
- Parameters:
file (str) – The path to the file to write to.
- find_variables(strings: List[str]) List[str] [source]
Finds variables in the given list of strings and returns them in a list.
- Parameters:
strings (List[str]) – The list of strings in which to find variables.
- Returns:
The list of variables found in the strings.
- Return type:
List[str]
- get_atom(atom_id: str, variables: dict) AuthorizationAtom | None [source]
Gets an authorization atom from this policy enforcement provider.
- Parameters:
atom_id (str) – The ID of the authorization atom to get.
variables (Dict[str, str], optional) – The map of variable names to values used to resolve the atom’s inputs, defaults to None.
- Returns:
The authorization atom with the specified ID and variable values, or None if no such atom exists or if any required variable values are missing.
- Return type:
AuthorizationAtom or None
- id: str
- name: str
- replace_variables(variables: dict, strings: List[str]) List[str] [source]
Replaces variables in the given list of strings with their corresponding values from the given map of variables.
- Parameters:
variables (Dict[str, str]) – The map of variables to replace in the strings.
strings (List[str]) – The list of strings in which to replace the variables.
- Returns:
The list of strings with variables replaced by their corresponding values from the map of variables.
- Return type:
List[str]
- version: str