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.

100 lines
2.3 KiB

7 years ago
  1. .. python-keycloak documentation master file, created by
  2. sphinx-quickstart on Tue Aug 15 11:02:59 2017.
  3. You can adapt this file completely to your liking, but it should at least
  4. contain the root `toctree` directive.
  5. .. toctree::
  6. :maxdepth: 2
  7. :caption: Contents:
  8. Indices and tables
  9. ==================
  10. * :ref:`genindex`
  11. * :ref:`modindex`
  12. * :ref:`search`
  13. .. image:: https://travis-ci.org/marcospereirampj/python-keycloak.svg?branch=master
  14. :target: https://travis-ci.org/marcospereirampj/python-keycloak
  15. .. image:: https://readthedocs.org/projects/python-keycloak/badge/?version=latest
  16. :target: http://python-keycloak.readthedocs.io/en/latest/?badge=latest
  17. Welcome to python-keycloak's documentation!
  18. ===========================================
  19. **python-keycloak** is a Python package providing access to the Keycloak API.
  20. Installation
  21. ==================
  22. Via Pypi Package::
  23. $ pip install python-keycloak
  24. Manually::
  25. $ python setup.py install
  26. Dependencies
  27. ==================
  28. python-keycloak depends on:
  29. * Python 3
  30. * `requests <http://docs.python-requests.org/en/master/>`_
  31. Tests Dependencies
  32. ------------------
  33. * unittest
  34. * `httmock <https://github.com/patrys/httmock>`_
  35. Bug reports
  36. ==================
  37. Please report bugs and feature requests at
  38. `https://github.com/marcospereirampj/python-keycloak/issues <https://github.com/marcospereirampj/python-keycloak/issues>`_
  39. Documentation
  40. ==================
  41. The documentation for python-keycloak is available on `readthedocs <http://python-keycloak.readthedocs.io>`_.
  42. Usage
  43. =====
  44. Main methods::
  45. from keycloak import Keycloak
  46. # Configure client
  47. keycloak = Keycloak(server_url="http://localhost:8080/auth/",
  48. client_id="example_client",
  49. realm_name="example_realm",
  50. client_secret_key="secret")
  51. # Get WellKnow
  52. config_well_know = keycloak.well_know()
  53. # Get Token
  54. token = keycloak.token("user", "password")
  55. # Get Userinfo
  56. userinfo = keycloak.userinfo(token['access_token'])
  57. # Logout
  58. keycloak.logout(token['refresh_token'])
  59. # Get Certs
  60. certs = keycloak.certs()
  61. # Get RPT (Entitlement)
  62. token = keycloak.token("user", "password")
  63. rpt = keycloak.entitlement(token['access_token'], "resource_id")
  64. # Instropect
  65. keycloak.instropect(token['access_token'], rpt['rpt'])