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.

77 lines
1.7 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. [![Build Status](https://travis-ci.org/marcospereirampj/python-keycloak.svg?branch=master)](https://travis-ci.org/marcospereirampj/python-keycloak)
  2. [![Documentation Status](https://readthedocs.org/projects/python-keycloak/badge/?version=latest)](http://python-keycloak.readthedocs.io/en/latest/?badge=latest)
  3. Python Keycloak
  4. ====================
  5. **python-keycloak** is a Python package providing access to the Keycloak API.
  6. # Installation
  7. ## Via Pypi Package:
  8. ```
  9. $ pip install python-keycloak
  10. ```
  11. ## Manually
  12. ```
  13. $ python setup.py install
  14. ```
  15. # Dependencies
  16. python-keycloak depends on:
  17. * Python 3
  18. * [requests](http://docs.python-requests.org/en/master/)
  19. ## Tests Dependencies
  20. * unittest
  21. * [httmock](https://github.com/patrys/httmock)
  22. # Bug reports
  23. Please report bugs and feature requests at
  24. https://github.com/marcospereirampj/python-keycloak/issues
  25. # Documentation
  26. The documentation for python-keycloak is available on [readthedocs](http://python-keycloak.readthedocs.io).
  27. # Usage
  28. ```
  29. from keycloak import Keycloak
  30. # Configure client
  31. keycloak = Keycloak(server_url="http://localhost:8080/auth/",
  32. client_id="example_client",
  33. realm_name="example_realm",
  34. client_secret_key="secret")
  35. # Get WellKnow
  36. config_well_know = keycloak.well_know()
  37. # Get Token
  38. token = keycloak.token("user", "password")
  39. # Get Userinfo
  40. userinfo = keycloak.userinfo(token['access_token'])
  41. # Logout
  42. keycloak.logout(token['refresh_token'])
  43. # Get Certs
  44. certs = keycloak.certs()
  45. # Get RPT (Entitlement)
  46. token = keycloak.token("user", "password")
  47. rpt = keycloak.entitlement(token['access_token'], "resource_id")
  48. # Instropect
  49. keycloak.instropect(token['access_token'], rpt['rpt'])
  50. ```