-
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.
Update OIDC handling and add policies (#57)
* Update OIDC handling * Update documentation * Update settings
- Loading branch information
1 parent
563a2cb
commit bb183f2
Showing
16 changed files
with
711 additions
and
155 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
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 |
---|---|---|
|
@@ -10,11 +10,12 @@ | |
* [OPENEO\_PREFIX](#openeo_fastapi.client.settings.AppSettings.OPENEO_PREFIX) | ||
* [OIDC\_URL](#openeo_fastapi.client.settings.AppSettings.OIDC_URL) | ||
* [OIDC\_ORGANISATION](#openeo_fastapi.client.settings.AppSettings.OIDC_ORGANISATION) | ||
* [OIDC\_ROLES](#openeo_fastapi.client.settings.AppSettings.OIDC_ROLES) | ||
* [OIDC\_POLICIES](#openeo_fastapi.client.settings.AppSettings.OIDC_POLICIES) | ||
* [STAC\_VERSION](#openeo_fastapi.client.settings.AppSettings.STAC_VERSION) | ||
* [STAC\_API\_URL](#openeo_fastapi.client.settings.AppSettings.STAC_API_URL) | ||
* [STAC\_COLLECTIONS\_WHITELIST](#openeo_fastapi.client.settings.AppSettings.STAC_COLLECTIONS_WHITELIST) | ||
* [ensure\_endswith\_slash](#openeo_fastapi.client.settings.AppSettings.ensure_endswith_slash) | ||
* [split\_oidc\_policies\_str\_to\_list](#openeo_fastapi.client.settings.AppSettings.split_oidc_policies_str_to_list) | ||
* [Config](#openeo_fastapi.client.settings.AppSettings.Config) | ||
|
||
<a id="openeo_fastapi.client.settings"></a> | ||
|
@@ -73,19 +74,37 @@ The OpenEO prefix to be used when creating the endpoint urls. | |
|
||
#### OIDC\_URL | ||
|
||
The URL of the OIDC provider used to authenticate tokens against. | ||
The policies to be used for authenticated users with the backend, if not set, any usser with a valid token from the issuer is accepted. | ||
|
||
<a id="openeo_fastapi.client.settings.AppSettings.OIDC_ORGANISATION"></a> | ||
|
||
#### OIDC\_ORGANISATION | ||
|
||
The abbreviation of the OIDC provider's organisation name, e.g. egi. | ||
|
||
<a id="openeo_fastapi.client.settings.AppSettings.OIDC_ROLES"></a> | ||
<a id="openeo_fastapi.client.settings.AppSettings.OIDC_POLICIES"></a> | ||
|
||
#### OIDC\_ROLES | ||
#### OIDC\_POLICIES | ||
|
||
The OIDC roles to check against when authenticating a user. | ||
The OIDC policies to check against when authorizing a user. If not provided, all users with a valid token from the issuer will be admitted. | ||
|
||
"&&" Is used to denote the addition of another policy. | ||
Policies in the list should be structures as "key, value". | ||
The key referers to some value that is expected to be found in the OIDC userinfo request. | ||
The value referes to some value that is then checked for presence in the values found at the key location. | ||
|
||
**Example**: | ||
|
||
``` | ||
{ | ||
"email": [email protected], | ||
"groups" : [ "/staff" ] | ||
} | ||
|
||
A valid policy to allow members from the group staff would be, "groups, /staff". This would be the value provided to OIDC_POLICIES. | ||
|
||
If you wanted to include users from another group called "/trial", the updated value to OIDC_POLICIES would be, "groups, /staff && groups, /trial" | ||
``` | ||
<a id="openeo_fastapi.client.settings.AppSettings.STAC_VERSION"></a> | ||
|
@@ -116,6 +135,17 @@ def ensure_endswith_slash(cls, v: str) -> str | |
|
||
Ensure the STAC_API_URL ends with a trailing slash. | ||
|
||
<a id="openeo_fastapi.client.settings.AppSettings.split_oidc_policies_str_to_list"></a> | ||
|
||
#### split\_oidc\_policies\_str\_to\_list | ||
|
||
```python | ||
@validator("OIDC_POLICIES", pre=True) | ||
def split_oidc_policies_str_to_list(cls, v: str) -> str | ||
``` | ||
|
||
Ensure the OIDC_POLICIES are split and formatted correctly. | ||
|
||
<a id="openeo_fastapi.client.settings.AppSettings.Config"></a> | ||
|
||
## Config Objects | ||
|
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
Oops, something went wrong.