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.

72 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
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. ``` $ pip install python-keycloak ```
  9. ### Manually
  10. ``` $ python setup.py install ```
  11. ## Dependencies
  12. python-keycloak depends on:
  13. * Python 3
  14. * [requests](http://docs.python-requests.org/en/master/)
  15. ### Tests Dependencies
  16. * unittest
  17. * [httmock](https://github.com/patrys/httmock)
  18. ## Bug reports
  19. Please report bugs and feature requests at
  20. https://github.com/marcospereirampj/python-keycloak/issues
  21. ## Documentation
  22. The documentation for python-keycloak is available on [readthedocs](http://python-keycloak.readthedocs.io).
  23. ## Usage
  24. ```
  25. from keycloak import Keycloak
  26. # Configure client
  27. keycloak = Keycloak(server_url="http://localhost:8080/auth/",
  28. client_id="example_client",
  29. realm_name="example_realm",
  30. client_secret_key="secret")
  31. # Get WellKnow
  32. config_well_know = keycloak.well_know()
  33. # Get Token
  34. token = keycloak.token("user", "password")
  35. # Get Userinfo
  36. userinfo = keycloak.userinfo(token['access_token'])
  37. # Logout
  38. keycloak.logout(token['refresh_token'])
  39. # Get Certs
  40. certs = keycloak.certs()
  41. # Get RPT (Entitlement)
  42. token = keycloak.token("user", "password")
  43. rpt = keycloak.entitlement(token['access_token'], "resource_id")
  44. # Instropect
  45. keycloak.instropect(token['access_token'], rpt['rpt'])
  46. ```