You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

10 months ago
  1. .. _uma:
  2. UMA
  3. ========================
  4. Configure client UMA
  5. -------------------------
  6. .. code-block:: python
  7. from keycloak import KeycloakOpenIDConnection
  8. from keycloak import KeycloakUMA
  9. keycloak_connection = KeycloakOpenIDConnection(
  10. server_url="http://localhost:8080/",
  11. realm_name="master",
  12. client_id="my_client",
  13. client_secret_key="client-secret")
  14. keycloak_uma = KeycloakUMA(connection=keycloak_connection)
  15. Create a resource set
  16. -------------------------
  17. .. code-block:: python
  18. resource_set = keycloak_uma.resource_set_create({
  19. "name": "example_resource",
  20. "scopes": ["example:read", "example:write"],
  21. "type": "urn:example"})
  22. List resource sets
  23. -------------------------
  24. .. code-block:: python
  25. resource_sets = uma.resource_set_list()
  26. Get resource set
  27. -------------------------
  28. .. code-block:: python
  29. latest_resource = uma.resource_set_read(resource_set["_id"])
  30. Update resource set
  31. -------------------------
  32. .. code-block:: python
  33. latest_resource["name"] = "New Resource Name"
  34. uma.resource_set_update(resource_set["_id"], latest_resource)
  35. Delete resource set
  36. ------------------------
  37. .. code-block:: python
  38. uma.resource_set_delete(resource_id=resource_set["_id"])