Skip to content

Commit f216ae2

Browse files
TemporaryPathCredentialsService, Credential Vending and Basic Server Access Control
1 parent d147b1f commit f216ae2

File tree

4 files changed

+95
-7
lines changed

4 files changed

+95
-7
lines changed

docs/basic-server-access-control/index.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## Securables
2222

23-
Unity Catalog supports the following types of securables to apply (_create_) permissions to:
23+
Unity Catalog defines the following securables to apply (_create_) permissions to:
2424

2525
1. `catalog`
2626
1. `function`
@@ -30,24 +30,40 @@ Unity Catalog supports the following types of securables to apply (_create_) per
3030
1. `table`
3131
1. `volume`
3232

33+
??? note "OpenAPI Generator"
34+
Securable types are defined in `SecurableType` enum in Unity Catalog's [OpenAPI specification]({{ uc.github }}/api/all.yaml).
35+
36+
## Principals
37+
38+
There are the following principal types supported in Unity Catalog:
39+
40+
* `USER`
41+
* `GROUP`
42+
43+
??? note "OpenAPI Generator"
44+
Principals are defined in `PrincipalType` enum in Unity Catalog's [OpenAPI specification]({{ uc.github }}/api/all.yaml).
45+
3346
## Privileges
3447

35-
The initial set of privileges are as follows:
48+
The privileges to grant are as follows:
3649

3750
Privilege | Description
3851
-|-
3952
`CREATE CATALOG` | Allows the principal to create catalogs
4053
`USE CATALOG` | Allows the principal to access/use a catalog
4154
`CREATE SCHEMA` | Allows the principal to create schemas within a catalog
4255
`USE SCHEMA` | Allows the principal to access/use the schema and child tables
43-
`CREATE_TABLE` | Allows the principal to create tables in the schema
56+
`CREATE TABLE` | Allows the principal to create tables in the schema
4457
`SELECT` | Allows the principal to run queries against table(s)
45-
`CREATE_FUNCTION` | Allows principal to create functions in the schema
58+
`CREATE FUNCTION` | Allows principal to create functions in the schema
4659
`EXECUTE` | Allows the principal to execute function(s)
47-
`CREATE_VOLUME` | Allows principal to create volumes in the schema
60+
`CREATE VOLUME` | Allows principal to create volumes in the schema
4861
`READ VOLUME` | Allows the principal to access volumes within the catalog
4962
`CREATE MODEL` | Allows the principal to create models within a schema
5063

64+
??? note "OpenAPI Generator"
65+
Privileges are defined in `Privilege` enum in Unity Catalog's [OpenAPI specification]({{ uc.github }}/api/all.yaml).
66+
5167
## Unity Catalog CLI
5268

5369
The CLI interface provides a new [permission](../cli/PermissionCli.md) command.

docs/credential-vending/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ Credential Vending supports the following privileges:
2323
??? note "Permissions"
2424
Privileges is a synonym of Permissions.
2525

26+
## Path Operations
27+
28+
There are the following path operations supported in Unity Catalog:
29+
30+
* `PATH_CREATE_TABLE`
31+
* `PATH_READ`
32+
* `PATH_READ_WRITE`
33+
* `UNKNOWN_PATH_OPERATION`
34+
35+
The path operations are used for [TemporaryPathCredentialsService](../server/TemporaryPathCredentialsService.md) to determine the [privileges for a path operation](../server/TemporaryPathCredentialsService.md#pathOperationToPrivileges) (while [generating temporary path credentials](../server/TemporaryPathCredentialsService.md#generateTemporaryPathCredential)).
36+
37+
??? note "OpenAPI Generator"
38+
Path operations are defined in `PathOperation` enum in Unity Catalog's [OpenAPI specification]({{ uc.github }}/api/all.yaml).
39+
2640
## Amazon S3
2741

2842
[Alex Reid once wrote]({{ uc.slack }}/C076YREKX8W/p1728333073156489?thread_ts=1728308961.254459&cid=C076YREKX8W):

docs/server/TableService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TableService
22

3-
`TableService` is a Unity Catalog API service that [UnityCatalogServer](UnityCatalogServer.md) uses to handle HTTP requests at `/api/2.1/unity-catalog/tables` URL.
3+
`TableService` is an API service that [UnityCatalogServer](UnityCatalogServer.md) uses to handle HTTP requests at `/api/2.1/unity-catalog/tables` URL.
44

55
Method | URL | Handler | Params
66
-|-|-|-

docs/server/TemporaryPathCredentialsService.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# TemporaryPathCredentialsService
22

3+
`TemporaryPathCredentialsService` is an API service of [UnityCatalogServer](UnityCatalogServer.md) to handle HTTP requests at `/api/2.1/unity-catalog/temporary-path-credentials` URL.
4+
5+
Method | URL | Handler | Params
6+
-|-|-|-
7+
POST | `/` | [generateTemporaryPathCredential](#generateTemporaryPathCredential) | JSON-ified `GenerateTemporaryPathCredential`
8+
9+
`TemporaryPathCredentialsService` handles `POST` requests only with the following authorization guarantees:
10+
11+
Method | AuthorizeExpression | Securables
12+
-|-|-
13+
POST | [authorize(#principal, #metastore, OWNER)](../server-authorization/AuthorizeExpression.md) | [METASTORE](../basic-server-access-control/index.md#securables)
14+
15+
## Demo
16+
17+
!!! note "etc/conf/server.properties"
18+
The following demo requires `url` being configured in [etc/conf/server.properties](index.md#server-configuration) (using`s3.bucketPath.0=s3://uc-japila` and the others).
19+
20+
```console
21+
$ http http://localhost:8081/api/2.1/unity-catalog/temporary-path-credentials \
22+
url=s3://uc-japila \
23+
operation=PATH_CREATE_TABLE
24+
HTTP/1.1 200 OK
25+
content-length: 1198
26+
content-type: application/json
27+
date: Sat, 2 Nov 2024 19:51:29 GMT
28+
server: Armeria/1.28.4
29+
30+
{
31+
"aws_temp_credentials": {
32+
"access_key_id": "xxx",
33+
"secret_access_key": "xxx",
34+
"session_token": "xxx"
35+
},
36+
"azure_user_delegation_sas": null,
37+
"expiration_time": null,
38+
"gcp_oauth_token": null
39+
}
40+
```
41+
342
## Creating Instance
443

544
`TemporaryPathCredentialsService` takes the following to be created:
@@ -17,4 +56,23 @@ HttpResponse generateTemporaryPathCredential(
1756
GenerateTemporaryPathCredential generateTemporaryPathCredential)
1857
```
1958

20-
`generateTemporaryPathCredential`...FIXME
59+
`generateTemporaryPathCredential` requests this [CredentialOperations](#credentialOps) to [vendCredential](../credential-vending/CredentialOperations.md#vendCredential) for the `url` and `operation` properties (of the given `GenerateTemporaryPathCredential`).
60+
61+
!!! note "Internal Server Error"
62+
`operation` should be one of the [supported path operations](../credential-vending/index.md#path-operations) or Unity Catalog reports an internal error.
63+
64+
### Privileges by Path Operation { #pathOperationToPrivileges }
65+
66+
```java
67+
Set<CredentialContext.Privilege> pathOperationToPrivileges(
68+
PathOperation pathOperation)
69+
```
70+
71+
`pathOperationToPrivileges` converts the given [PathOperation](../credential-vending/index.md#path-operations) to [Privileges](../basic-server-access-control/index.md#privileges):
72+
73+
PathOperation | Privileges
74+
-|-
75+
`PATH_READ` | `SELECT`
76+
`PATH_READ_WRITE` | `SELECT` and `UPDATE`
77+
`PATH_CREATE_TABLE` | `SELECT` and `UPDATE`
78+
`UNKNOWN_PATH_OPERATION` | (empty)

0 commit comments

Comments
 (0)