forked from Mirror/python-keycloak
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.
Marcos Pereira
f4a44dc22e
|
7 years ago | |
---|---|---|
docs | 7 years ago | |
keycloak | 7 years ago | |
.gitignore | 7 years ago | |
.travis.yml | 7 years ago | |
LICENSE | 7 years ago | |
README.md | 7 years ago | |
requirements.txt | 7 years ago | |
setup.cfg | 7 years ago | |
setup.py | 7 years ago |
README.md
Python Keycloak
python-keycloak is a Python package providing access to the Keycloak API.
Installation
Via Pypi Package:
$ pip install python-keycloak
Manually
$ python setup.py install
Dependencies
python-keycloak depends on:
- Python 3
- requests
Tests Dependencies
- unittest
- httmock
Bug reports
Please report bugs and feature requests at https://github.com/marcospereirampj/python-keycloak/issues
Documentation
The documentation for python-keycloak is available on readthedocs.
Usage
from keycloak import Keycloak
# Configure client
keycloak = Keycloak(server_url="http://localhost:8080/auth/",
client_id="example_client",
realm_name="example_realm",
client_secret_key="secret")
# Get WellKnow
config_well_know = keycloak.well_know()
# Get Token
token = keycloak.token("user", "password")
# Get Userinfo
userinfo = keycloak.userinfo(token['access_token'])
# Logout
keycloak.logout(token['refresh_token'])
# Get Certs
certs = keycloak.certs()
# Get RPT (Entitlement)
token = keycloak.token("user", "password")
rpt = keycloak.entitlement(token['access_token'], "resource_id")
# Instropect
keycloak.instropect(token['access_token'], rpt['rpt'])