keycloak.keycloak_uma
¶
Keycloak UMA module.
The module contains a UMA compatible client for keycloak: https://docs.kantarainitiative.org/uma/wg/rec-oauth-uma-federated-authz-2.0.html
Module Contents¶
Classes¶
Keycloak UMA client. |
- class keycloak.keycloak_uma.KeycloakUMA(connection: keycloak.openid_connection.KeycloakOpenIDConnection)[source]¶
Keycloak UMA client.
- Parameters:
connection – OpenID connection manager
- property uma_well_known[source]¶
Get the well_known UMA2 config.
- Returns:
It lists endpoints and other configuration options relevant
- Return type:
dict
- static format_url(url, **kwargs)[source]¶
Substitute url path parameters.
Given a parameterized url string, returns the string after url encoding and substituting the given params. For example, format_url(“https://myserver/{my_resource}/{id}”, my_resource=”hello world”, id=”myid”) would produce https://myserver/hello+world/myid.
- Parameters:
url (str) – url string to format
kwargs (dict) – dict containing kwargs to substitute
- Returns:
formatted string
- Return type:
str
- resource_set_create(payload)[source]¶
Create a resource set.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#rfc.section.2.2.1
ResourceRepresentation https://www.keycloak.org/docs-api/20.0.0/rest-api/index.html#_resourcerepresentation
- Parameters:
payload (dict) – ResourceRepresentation
- Returns:
ResourceRepresentation with the _id property assigned
- Return type:
dict
- resource_set_update(resource_id, payload)[source]¶
Update a resource set.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#update-resource-set
ResourceRepresentation https://www.keycloak.org/docs-api/20.0.0/rest-api/index.html#_resourcerepresentation
- Parameters:
resource_id (str) – id of the resource
payload (dict) – ResourceRepresentation
- Returns:
Response dict (empty)
- Return type:
dict
- resource_set_read(resource_id)[source]¶
Read a resource set.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#read-resource-set
ResourceRepresentation https://www.keycloak.org/docs-api/20.0.0/rest-api/index.html#_resourcerepresentation
- Parameters:
resource_id (str) – id of the resource
- Returns:
ResourceRepresentation
- Return type:
dict
- resource_set_delete(resource_id)[source]¶
Delete a resource set.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#delete-resource-set
- Parameters:
resource_id (str) – id of the resource
- Returns:
Response dict (empty)
- Return type:
dict
- resource_set_list_ids()[source]¶
List all resource set ids.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#list-resource-sets
- Returns:
List of ids
- Return type:
List[str]
- resource_set_list()[source]¶
List all resource sets.
Spec https://docs.kantarainitiative.org/uma/rec-oauth-resource-reg-v1_0_1.html#list-resource-sets
ResourceRepresentation https://www.keycloak.org/docs-api/20.0.0/rest-api/index.html#_resourcerepresentation
- Yields:
Iterator over a list of ResourceRepresentations
- Return type:
Iterator[dict]