-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UnityAccessDecorator, UnityAccessEvaluator and UnityCatalogAuthorizer
- Loading branch information
1 parent
7b8354a
commit 37e4fa6
Showing
5 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# MetastoreRepository | ||
|
||
`MetastoreRepository` is...FIXME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# KeyMapperUtil | ||
|
||
## Resolve Resource Names Into IDs { #mapResourceKeys } | ||
|
||
``` java | ||
Map<SecurableType, Object> mapResourceKeys( | ||
Map<SecurableType, Object> resourceKeys) | ||
``` | ||
|
||
??? note "Static Method" | ||
`mapResourceKeys` is a Java **class method** to be invoked without a reference to a particular object. | ||
|
||
Learn more in the [Java Language Specification]({{ java.spec }}/jls-8.html#jls-8.4.3.2). | ||
|
||
`mapResourceKeys` resolves the given `SecurableType`s with their names (`resourceKeys`) into `SecurableType`s with IDs (in the given order). | ||
|
||
Resource Keys | SecurableType | ID | Repository | ||
-|-|-|- | ||
CATALOG, SCHEMA, TABLE | TABLE | `table_id` | [TableRepository](../persistent-storage/TableRepository.md#getTable) | ||
TABLE<br>(with neither CATALOG nor SCHEMA) | TABLE<br>SCHEMA<br>CATALOG | `table_id`<br>`schema_id`<br>`id` | [TableRepository](../persistent-storage/TableRepository.md#getTable)<br>[SchemaRepository](../persistent-storage/SchemaRepository.md#getSchema)<br>[CatalogRepository](../persistent-storage/CatalogRepository.md#getCatalog) | ||
CATALOG, SCHEMA, VOLUME | VOLUME | `volume_id` | [VolumeRepository](../persistent-storage/VolumeRepository.md#getVolume) | ||
VOLUME<br>(with neither CATALOG nor SCHEMA) | | | | ||
CATALOG, SCHEMA, FUNCTION | | | | ||
FUNCTION<br>(with neither CATALOG nor SCHEMA) | | | | ||
CATALOG, SCHEMA, REGISTERED_MODEL | | | | ||
REGISTERED_MODEL<br>(with neither CATALOG nor SCHEMA) | | | | ||
CATALOG, SCHEMA | SCHEMA | `schema_id` | [SchemaRepository](../persistent-storage/SchemaRepository.md#getSchema) | ||
SCHEMA<br>(with no CATALOG) | SCHEMA<br>CATALOG | `schema_id`<br>`id` | [SchemaRepository](../persistent-storage/SchemaRepository.md#getSchema)<br>[CatalogRepository](../persistent-storage/CatalogRepository.md#getCatalog) | ||
CATALOG | CATALOG | `id` | [CatalogRepository](../persistent-storage/CatalogRepository.md#getCatalog) | ||
METASTORE | METASTORE | `ca7a1095-537c-4f9c-a136-5ca1ab1ec0de` | [MetastoreRepository](../persistent-storage/MetastoreRepository.md#getMetastoreId) | ||
|
||
--- | ||
|
||
`mapResourceKeys` is used when: | ||
|
||
* `UnityAccessDecorator` is requested to [check authorization](UnityAccessDecorator.md#checkAuthorization) | ||
* `TemporaryModelVersionCredentialsService` is requested to [authorizeForOperation](../server/TemporaryModelVersionCredentialsService.md#authorizeForOperation) | ||
* `TemporaryTableCredentialsService` is requested to [authorizeForOperation](../server/TemporaryTableCredentialsService.md#authorizeForOperation) | ||
* `TemporaryVolumeCredentialsService` is requested to [authorizeForOperation](../server/TemporaryVolumeCredentialsService.md#authorizeForOperation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,66 @@ | ||
# UnityAccessEvaluator | ||
|
||
`UnityAccessEvaluator` is...FIXME | ||
## Evaluate Authorization Expression { #evaluate } | ||
|
||
``` java | ||
boolean evaluate( | ||
UUID principal, | ||
String expression, | ||
Map<SecurableType, Object> resourceIds) | ||
``` | ||
|
||
`evaluate` returns whatever the given `expression` has been evaluated to for the given `principal` and the resource IDs. | ||
|
||
--- | ||
|
||
`evaluate` creates a `StandardEvaluationContext` (Spring Expression Language) with `Privileges` root object. | ||
|
||
`evaluate` registers the following functions in the `StandardEvaluationContext`: | ||
|
||
Function | Handler | ||
-|- | ||
authorize | [authorizeHandle](UnityCatalogAuthorizer.md#authorize) | ||
authorizeAny | [authorizeAnyHandle](UnityCatalogAuthorizer.md#authorizeAny) | ||
authorizeAll | [authorizeAllHandle](UnityCatalogAuthorizer.md#authorizeAll) | ||
|
||
`evaluate` sets the following variables in the `StandardEvaluationContext`: | ||
|
||
Variable | Value | ||
-|- | ||
deny | FALSE | ||
permit | TRUE | ||
defer | TRUE | ||
principal | The given `principal` | ||
|
||
`evaluate` sets variables (in the `StandardEvaluationContext`) for every resource ID (in the given `resourceIds`). | ||
|
||
`evaluate` requests this [ExpressionParser](#parser) to evaluate the expression (in the `StandardEvaluationContext`). | ||
|
||
`evaluate` prints out the following DEBUG message to the logs: | ||
|
||
``` text | ||
evaluating [expression] = [result] | ||
``` | ||
|
||
--- | ||
|
||
`evaluate` is used when: | ||
|
||
* `UnityAccessDecorator` is requested to [check authorization](UnityAccessDecorator.md#checkAuthorization) | ||
* `UnityAccessEvaluator` is requested to [filter](#filter) | ||
* `TemporaryModelVersionCredentialsService` is requested to [authorizeForOperation](../server/TemporaryModelVersionCredentialsService.md#authorizeForOperation) | ||
* `TemporaryTableCredentialsService` is requested to [authorizeForOperation](../server/TemporaryTableCredentialsService.md#authorizeForOperation) | ||
* `TemporaryVolumeCredentialsService` is requested to [authorizeForOperation](../server/TemporaryVolumeCredentialsService.md#authorizeForOperation) | ||
|
||
## Logging | ||
|
||
Enable `ALL` logging level for `io.unitycatalog.server.auth.decorator.UnityAccessEvaluator` logger to see what happens inside. | ||
|
||
Add the following line to `etc/conf/server.log4j2.properties`: | ||
|
||
``` text | ||
logger.UnityAccessEvaluator.name = io.unitycatalog.server.auth.decorator.UnityAccessEvaluator | ||
logger.UnityAccessEvaluator.level = all | ||
``` | ||
|
||
Refer to [Logging](../logging.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters