Skip to content

Commit 0c04245

Browse files
Scim2SelfService
1 parent 40ef79b commit 0c04245

10 files changed

+113
-73
lines changed

docs/server/CatalogService.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ HttpResponse listCatalogs()
4646
## Demo
4747

4848
```console
49-
$ http http://localhost:8081/api/2.1/unity-catalog/catalogs
49+
$ http http://localhost:8080/api/2.1/unity-catalog/catalogs
5050
HTTP/1.1 200 OK
5151
content-length: 184
5252
content-type: application/json
@@ -69,6 +69,6 @@ server: Armeria/1.28.4
6969
```
7070

7171
```console
72-
$ http http://localhost:8081/api/2.1/unity-catalog/catalogs | jq '.catalogs[].name'
72+
$ http http://localhost:8080/api/2.1/unity-catalog/catalogs | jq '.catalogs[].name'
7373
"unity"
7474
```

docs/server/MetastoreService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Method | URL | Handler | Params
77
GET | `/metastore_summary` | [getMetastoreSummary](#getMetastoreSummary) |  
88

99
```console
10-
$ http http://localhost:8081/api/2.1/unity-catalog/metastore_summary | jq '.metastore_id'
10+
$ http http://localhost:8080/api/2.1/unity-catalog/metastore_summary | jq '.metastore_id'
1111
"92418bf6-e62c-4d4c-bb5d-e5eda5c82688"
1212
```
1313

docs/server/ModelService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ HttpResponse createRegisteredModel(
4848
!!! note "Example"
4949

5050
```console
51-
$ http http://localhost:8081/api/2.1/unity-catalog/models | jq '.registered_models'
51+
$ http http://localhost:8080/api/2.1/unity-catalog/models | jq '.registered_models'
5252
[]
5353
```

docs/server/PermissionService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Method | URL | Handler | AuthorizeKey
1818
... | | |
1919

2020
``` console
21-
$ http http://localhost:8081/api/2.1/unity-catalog/permissions/catalog/unity
21+
$ http http://localhost:8080/api/2.1/unity-catalog/permissions/catalog/unity
2222
HTTP/1.1 200 OK
2323
content-length: 28
2424
content-type: application/json

docs/server/Scim2SelfService.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Scim2SelfService
2+
3+
`Scim2SelfService` is a SCIM2-compliant `/Me` endpoint.
4+
5+
`Scim2SelfService` is an API service of [UnityCatalogServer](UnityCatalogServer.md) to handle HTTP requests at `/api/1.0/unity-control/scim2/Me` URL.
6+
7+
Method | URL | Handler | Params
8+
-|-|-|-
9+
GET | - | [getCurrentUser](#getCurrentUser) | -
10+
11+
```console
12+
# 🛑 Start the UC server with server authorization enabled
13+
$ http http://localhost:8080/api/1.0/unity-control/scim2/Me
14+
HTTP/1.1 401 Unauthorized
15+
content-length: 173
16+
content-type: application/json
17+
date: Tue, 17 Dec 2024 21:23:01 GMT
18+
server: Armeria/1.28.4
19+
20+
{
21+
"details": [
22+
{
23+
"@type": "google.rpc.ErrorInfo",
24+
"metadata": {},
25+
"reason": "UNAUTHENTICATED"
26+
}
27+
],
28+
"error_code": "UNAUTHENTICATED",
29+
"message": "No authorization found.",
30+
"stack_trace": null
31+
}
32+
```
33+
34+
```console
35+
$ http -A bearer -a $(cat etc/conf/token.txt) \
36+
http://localhost:8080/api/1.0/unity-control/scim2/Me
37+
HTTP/1.1 200 OK
38+
content-length: 345
39+
content-type: application/scim+json
40+
date: Tue, 17 Dec 2024 21:23:29 GMT
41+
server: Armeria/1.28.4
42+
43+
{
44+
"active": true,
45+
"displayName": "Admin",
46+
"emails": [
47+
{
48+
"primary": true,
49+
"value": "admin"
50+
}
51+
],
52+
"id": "cd941442-6635-45b9-bc7a-c9b527600b3b",
53+
"meta": {
54+
"created": "2024-11-08T17:40:16.216+00:00",
55+
"lastModified": "2024-12-17T21:23:29.251+00:00",
56+
"resourceType": "User"
57+
},
58+
"photos": [
59+
{
60+
"value": ""
61+
}
62+
],
63+
"schemas": [
64+
"urn:ietf:params:scim:schemas:core:2.0:User"
65+
],
66+
"userName": "admin"
67+
}
68+
```
69+
70+
## Creating Instance
71+
72+
`Scim2SelfService` takes the following to be created:
73+
74+
* <span id="authorizer"> [UnityCatalogAuthorizer](../server-authorization/UnityCatalogAuthorizer.md)
75+
76+
`Scim2SelfService` is created when:
77+
78+
* `UnityCatalogServer` is requested to [register the API services](UnityCatalogServer.md#addServices)
79+
80+
## UserRepository { #USER_REPOSITORY }
81+
82+
`Scim2SelfService` looks up the system-wide [UserRepository](../persistent-storage/UserRepository.md#getInstance) when [created](#creating-instance).
83+
84+
## Get Current User { #getCurrentUser }
85+
86+
```java
87+
UserResource getCurrentUser()
88+
```
89+
90+
`getCurrentUser` finds a [JSON web token](../server-authorization/AuthDecorator.md#DECODED_JWT_ATTR) in the server-side request context.
91+
92+
`getCurrentUser` uses the `sub` claim (of the decoded JSON web token) as the email of a user to look up.
93+
94+
`getCurrentUser` requests the system-wide [UserRepository](#USER_REPOSITORY) instance to [look up a user by the email](../persistent-storage/UserRepository.md#getUserByEmail).
95+
96+
??? note "Scim2RuntimeException"
97+
`getCurrentUser` reports a `Scim2RuntimeException` when there is no [JSON web token](../server-authorization/AuthDecorator.md#DECODED_JWT_ATTR) in the server-side request context:
98+
99+
```text
100+
No user found.
101+
```

docs/server/Scim2UserService.md

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Method | URL | Handler | Params
88
-|-|-|-
99
GET | `/` | [getScimUsers](#getScimUsers) | <ul><li>filter<li>startIndex<li>count</ul>
1010
POST | `/` | [createScimUser](#createScimUser) | JSON-ified `UserResource`
11-
GET | `/self` | [getCurrentUser](#getCurrentUser) | -
1211
GET | `/{id}` | [getUser](#getUser) | <ul><li>id</ul>
1312
PUT | `/{id}` | [updateUser](#updateUser) | <ul><li>id<li>JSON-ified `UserResource`</ul>
1413
DELETE | `/{id}` | [deleteUser](#deleteUser) | <ul><li>id</ul>
@@ -27,29 +26,6 @@ Method | URL | Handler | Params
2726

2827
* `UnityCatalogServer` is requested to [register the API services](UnityCatalogServer.md#addServices)
2928

30-
## getCurrentUser { #getCurrentUser }
31-
32-
```java
33-
UserResource getCurrentUser()
34-
```
35-
36-
??? note "Authorization"
37-
`getCurrentUser` handles `POST` requests with the following:
38-
39-
* [AuthorizeExpression](../server-authorization/AuthorizeExpression.md): `#principal != null`
40-
* [AuthorizeKey](../server-authorization/AuthorizeKey.md): `METASTORE`
41-
42-
`getCurrentUser` finds a [JSON web token](../server-authorization/AuthDecorator.md#DECODED_JWT_ATTR) in the server-side request context.
43-
44-
`getCurrentUser` returns the [getUserByEmail](../persistent-storage/UserRepository.md#getUserByEmail) (from the system-wide [UserRepository](#USER_REPOSITORY)) for the `sub` claim of the decoded JSON web token.
45-
46-
??? note "Scim2RuntimeException for no JSON web token"
47-
`getCurrentUser` reports a `Scim2RuntimeException` when there is no [JSON web token](../server-authorization/AuthDecorator.md#DECODED_JWT_ATTR) in the server-side request context:
48-
49-
```text
50-
No user found.
51-
```
52-
5329
## Examples
5430

5531
### Get All Users
@@ -142,41 +118,3 @@ server: Armeria/1.28.4
142118
"userName": "admin"
143119
}
144120
```
145-
146-
### Get Current User
147-
148-
```console
149-
$ https -A bearer -a $(cat etc/conf/token.txt) \
150-
http://localhost:8080/api/1.0/unity-control/scim2/Users/self
151-
HTTP/1.1 200 OK
152-
content-length: 345
153-
content-type: application/scim+json
154-
date: Sat, 9 Nov 2024 12:35:40 GMT
155-
server: Armeria/1.28.4
156-
157-
{
158-
"active": true,
159-
"displayName": "Admin",
160-
"emails": [
161-
{
162-
"primary": true,
163-
"value": "admin"
164-
}
165-
],
166-
"id": "cd941442-6635-45b9-bc7a-c9b527600b3b",
167-
"meta": {
168-
"created": "2024-11-08T17:40:16.216+00:00",
169-
"lastModified": "2024-11-09T12:35:40.341+00:00",
170-
"resourceType": "User"
171-
},
172-
"photos": [
173-
{
174-
"value": ""
175-
}
176-
],
177-
"schemas": [
178-
"urn:ietf:params:scim:schemas:core:2.0:User"
179-
],
180-
"userName": "admin"
181-
}
182-
```

docs/server/TableService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Method | URL | Handler | Params
1010
DELETE | `/{full_name}` | [deleteTable](#deleteTable) | <ul><li>fullName</ul>
1111

1212
```console
13-
$ http http://localhost:8081/api/2.1/unity-catalog/tables catalog_name==unity schema_name==default | jq '.tables[].name'
13+
$ http http://localhost:8080/api/2.1/unity-catalog/tables catalog_name==unity schema_name==default | jq '.tables[].name'
1414
"numbers"
1515
"marksheet_uniform"
1616
"marksheet"

docs/server/TemporaryPathCredentialsService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Method | AuthorizeExpression | Securables
1818
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).
1919

2020
```console
21-
$ http http://localhost:8081/api/2.1/unity-catalog/temporary-path-credentials \
21+
$ http http://localhost:8080/api/2.1/unity-catalog/temporary-path-credentials \
2222
url=s3://uc-japila \
2323
operation=PATH_CREATE_TABLE
2424
HTTP/1.1 200 OK

docs/server/TemporaryTableCredentialsService.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ HttpResponse generateTemporaryTableCredential(
4343
### Local File System
4444

4545
```console
46-
$ http http://localhost:8081/api/2.1/unity-catalog/temporary-table-credentials \
46+
$ http http://localhost:8080/api/2.1/unity-catalog/temporary-table-credentials \
4747
table_id=b5d6db68-5eca-485c-be5f-5f53d4f27f60 \
4848
operation=READ
4949
HTTP/1.1 200 OK
@@ -102,7 +102,7 @@ $ ./bin/uc table create \
102102
```
103103

104104
```console
105-
$ http http://localhost:8081/api/2.1/unity-catalog/temporary-table-credentials \
105+
$ http http://localhost:8080/api/2.1/unity-catalog/temporary-table-credentials \
106106
table_id=020270b2-621e-4157-a73d-6a63c3b86bdd \
107107
operation=READ
108108

@@ -143,7 +143,7 @@ s3.sessionToken.0=FIXME_sessionToken
143143
```
144144

145145
```console
146-
$ http http://localhost:8081/api/2.1/unity-catalog/temporary-table-credentials \
146+
$ http http://localhost:8080/api/2.1/unity-catalog/temporary-table-credentials \
147147
table_id=020270b2-621e-4157-a73d-6a63c3b86bdd \
148148
operation=READ
149149
HTTP/1.1 200 OK

docs/server/UnityCatalogServer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ usage: bin/start-uc-server
1616
-v,--version Display the version of the Unity Catalog server
1717
```
1818

19-
`UnityCatalogServer` starts Armeria documentation service at http://localhost:8081/docs and the other [Unity Catalog API services](#addServices).
19+
`UnityCatalogServer` starts Armeria documentation service at http://localhost:8080/docs and the other [Unity Catalog API services](#addServices).
2020

2121
## Metastore
2222

@@ -86,6 +86,7 @@ URL | Service
8686
-|-
8787
`/` | Returns `Hello, Unity Catalog!` message
8888
`/api/1.0/unity-control/auth` | [AuthService](AuthService.md)
89+
`/api/1.0/unity-control/scim2/Me` | [Scim2SelfService](Scim2SelfService.md)
8990
`/api/1.0/unity-control/scim2/Users` | [Scim2UserService](Scim2UserService.md)
9091
`/api/2.1/unity-catalog/` | [MetastoreService](MetastoreService.md)
9192
`/api/2.1/unity-catalog/catalogs` | [CatalogService](CatalogService.md)

0 commit comments

Comments
 (0)