Name | python-keycloak JSON |
Version |
5.1.1
JSON |
| download |
home_page | None |
Summary | python-keycloak is a Python package providing access to the Keycloak API. |
upload_time | 2024-12-15 19:34:13 |
maintainer | None |
docs_url | None |
author | Marcos Pereira |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
keycloak
openid
oidc
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![CircleCI](https://github.com/marcospereirampj/python-keycloak/actions/workflows/daily.yaml/badge.svg)](https://github.com/marcospereirampj/python-keycloak/)
[![Documentation Status](https://readthedocs.org/projects/python-keycloak/badge/?version=latest)](http://python-keycloak.readthedocs.io/en/latest/?badge=latest)
# Python Keycloak
**python-keycloak** is a Python package providing access to the Keycloak API.
## Installation
Install via PyPI:
`$ pip install python-keycloak`
## 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](http://python-keycloak.readthedocs.io).
## Keycloak version support
The library strives to always support Keycloak's latest version. Additionally to that, we also support 5 latest major versions of Keycloak,
in order to give our user base more time for smoother upgrades.
Current list of supported Keycloak versions:
- 26.X
- 25.X
- 24.X
- 23.X
- 22.X
## Python version support
We only support Python versions that have active or security support by the Python Software Foundation. You can find the list of active Python versions [here](https://endoflife.date/python).
## Example of Using Keycloak OpenID
```python
from keycloak import KeycloakOpenID
# Configure client
keycloak_openid = KeycloakOpenID(server_url="http://localhost:8080/auth/",
client_id="example_client",
realm_name="example_realm",
client_secret_key="secret")
# Get WellKnown
config_well_known = keycloak_openid.well_known()
# Get Code With Oauth Authorization Request
auth_url = keycloak_openid.auth_url(
redirect_uri="your_call_back_url",
scope="email",
state="your_state_info")
# Get Access Token With Code
access_token = keycloak_openid.token(
grant_type='authorization_code',
code='the_code_you_get_from_auth_url_callback',
redirect_uri="your_call_back_url")
# Get Token
token = keycloak_openid.token("user", "password")
token = keycloak_openid.token("user", "password", totp="012345")
# Get token using Token Exchange
token = keycloak_openid.exchange_token(token['access_token'], "my_client", "other_client", "some_user")
# Get Userinfo
userinfo = keycloak_openid.userinfo(token['access_token'])
# Refresh token
token = keycloak_openid.refresh_token(token['refresh_token'])
# Logout
keycloak_openid.logout(token['refresh_token'])
```
## Example of Using Keycloak Admin API
```python
from keycloak import KeycloakAdmin
from keycloak import KeycloakOpenIDConnection
keycloak_connection = KeycloakOpenIDConnection(
server_url="http://localhost:8080/",
username='example-admin',
password='secret',
realm_name="master",
user_realm_name="only_if_other_realm_than_master",
client_id="my_client",
client_secret_key="client-secret",
verify=True)
keycloak_admin = KeycloakAdmin(connection=keycloak_connection)
# Add user
new_user = keycloak_admin.create_user({"email": "example@example.com",
"username": "example@example.com",
"enabled": True,
"firstName": "Example",
"lastName": "Example"})
# Add user and raise exception if username already exists
# exist_ok currently defaults to True for backwards compatibility reasons
new_user = keycloak_admin.create_user({"email": "example@example.com",
"username": "example@example.com",
"enabled": True,
"firstName": "Example",
"lastName": "Example"},
exist_ok=False)
# Add user and set password
new_user = keycloak_admin.create_user({"email": "example@example.com",
"username": "example@example.com",
"enabled": True,
"firstName": "Example",
"lastName": "Example",
"credentials": [{"value": "secret","type": "password",}]})
```
For more details, see the documentation available on [readthedocs](http://python-keycloak.readthedocs.io).
Raw data
{
"_id": null,
"home_page": null,
"name": "python-keycloak",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "keycloak, openid, oidc",
"author": "Marcos Pereira",
"author_email": "marcospereira.mpj@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/19/02/af847b03964984ce3ea4ad6c80a26cb95cd100804f27f3b06f397357fabc/python_keycloak-5.1.1.tar.gz",
"platform": null,
"description": "[![CircleCI](https://github.com/marcospereirampj/python-keycloak/actions/workflows/daily.yaml/badge.svg)](https://github.com/marcospereirampj/python-keycloak/)\n[![Documentation Status](https://readthedocs.org/projects/python-keycloak/badge/?version=latest)](http://python-keycloak.readthedocs.io/en/latest/?badge=latest)\n\n# Python Keycloak\n\n**python-keycloak** is a Python package providing access to the Keycloak API.\n\n## Installation\n\nInstall via PyPI:\n\n`$ pip install python-keycloak`\n\n## Bug reports\n\nPlease report bugs and feature requests at\nhttps://github.com/marcospereirampj/python-keycloak/issues\n\n## Documentation\n\nThe documentation for python-keycloak is available on [readthedocs](http://python-keycloak.readthedocs.io).\n\n## Keycloak version support\n\nThe library strives to always support Keycloak's latest version. Additionally to that, we also support 5 latest major versions of Keycloak,\nin order to give our user base more time for smoother upgrades.\n\nCurrent list of supported Keycloak versions:\n\n- 26.X\n- 25.X\n- 24.X\n- 23.X\n- 22.X\n\n## Python version support\n\nWe only support Python versions that have active or security support by the Python Software Foundation. You can find the list of active Python versions [here](https://endoflife.date/python).\n\n## Example of Using Keycloak OpenID\n\n```python\nfrom keycloak import KeycloakOpenID\n\n# Configure client\nkeycloak_openid = KeycloakOpenID(server_url=\"http://localhost:8080/auth/\",\n client_id=\"example_client\",\n realm_name=\"example_realm\",\n client_secret_key=\"secret\")\n\n# Get WellKnown\nconfig_well_known = keycloak_openid.well_known()\n\n# Get Code With Oauth Authorization Request\nauth_url = keycloak_openid.auth_url(\n redirect_uri=\"your_call_back_url\",\n scope=\"email\",\n state=\"your_state_info\")\n\n# Get Access Token With Code\naccess_token = keycloak_openid.token(\n grant_type='authorization_code',\n code='the_code_you_get_from_auth_url_callback',\n redirect_uri=\"your_call_back_url\")\n\n\n# Get Token\ntoken = keycloak_openid.token(\"user\", \"password\")\ntoken = keycloak_openid.token(\"user\", \"password\", totp=\"012345\")\n\n# Get token using Token Exchange\ntoken = keycloak_openid.exchange_token(token['access_token'], \"my_client\", \"other_client\", \"some_user\")\n\n# Get Userinfo\nuserinfo = keycloak_openid.userinfo(token['access_token'])\n\n# Refresh token\ntoken = keycloak_openid.refresh_token(token['refresh_token'])\n\n# Logout\nkeycloak_openid.logout(token['refresh_token'])\n```\n\n## Example of Using Keycloak Admin API\n\n```python\nfrom keycloak import KeycloakAdmin\nfrom keycloak import KeycloakOpenIDConnection\n\nkeycloak_connection = KeycloakOpenIDConnection(\n server_url=\"http://localhost:8080/\",\n username='example-admin',\n password='secret',\n realm_name=\"master\",\n user_realm_name=\"only_if_other_realm_than_master\",\n client_id=\"my_client\",\n client_secret_key=\"client-secret\",\n verify=True)\n\nkeycloak_admin = KeycloakAdmin(connection=keycloak_connection)\n\n# Add user\nnew_user = keycloak_admin.create_user({\"email\": \"example@example.com\",\n \"username\": \"example@example.com\",\n \"enabled\": True,\n \"firstName\": \"Example\",\n \"lastName\": \"Example\"})\n\n# Add user and raise exception if username already exists\n# exist_ok currently defaults to True for backwards compatibility reasons\nnew_user = keycloak_admin.create_user({\"email\": \"example@example.com\",\n \"username\": \"example@example.com\",\n \"enabled\": True,\n \"firstName\": \"Example\",\n \"lastName\": \"Example\"},\n exist_ok=False)\n\n# Add user and set password\nnew_user = keycloak_admin.create_user({\"email\": \"example@example.com\",\n \"username\": \"example@example.com\",\n \"enabled\": True,\n \"firstName\": \"Example\",\n \"lastName\": \"Example\",\n \"credentials\": [{\"value\": \"secret\",\"type\": \"password\",}]})\n```\n\nFor more details, see the documentation available on [readthedocs](http://python-keycloak.readthedocs.io).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "python-keycloak is a Python package providing access to the Keycloak API.",
"version": "5.1.1",
"project_urls": {
"Changelog": "https://raw.githubusercontent.com/marcospereirampj/python-keycloak/master/CHANGELOG.md",
"Documentation": "https://python-keycloak.readthedocs.io/en/latest/",
"Issue tracker": "https://github.com/marcospereirampj/python-keycloak/issues"
},
"split_keywords": [
"keycloak",
" openid",
" oidc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4dcf0f7a1a5f2a32ea2a98250f7d25930e7b6955b80e344e90b635b5748fd02d",
"md5": "bc8f6aeaec33091e0b281ff9fb5a692f",
"sha256": "0df2ae75c80cc0646dc2a57f353f284edcbde3ca77e15526f403e3b38dfcffca"
},
"downloads": -1,
"filename": "python_keycloak-5.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc8f6aeaec33091e0b281ff9fb5a692f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 78348,
"upload_time": "2024-12-15T19:34:10",
"upload_time_iso_8601": "2024-12-15T19:34:10.788672Z",
"url": "https://files.pythonhosted.org/packages/4d/cf/0f7a1a5f2a32ea2a98250f7d25930e7b6955b80e344e90b635b5748fd02d/python_keycloak-5.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1902af847b03964984ce3ea4ad6c80a26cb95cd100804f27f3b06f397357fabc",
"md5": "2a0805eac749f6239268ba511a393a3b",
"sha256": "406c5ad621c0fc911aacb8665b4eec0aebca7e88546ca6d313ebbe966080604b"
},
"downloads": -1,
"filename": "python_keycloak-5.1.1.tar.gz",
"has_sig": false,
"md5_digest": "2a0805eac749f6239268ba511a393a3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 64559,
"upload_time": "2024-12-15T19:34:13",
"upload_time_iso_8601": "2024-12-15T19:34:13.449910Z",
"url": "https://files.pythonhosted.org/packages/19/02/af847b03964984ce3ea4ad6c80a26cb95cd100804f27f3b06f397357fabc/python_keycloak-5.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-15 19:34:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "marcospereirampj",
"github_project": "python-keycloak",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "python-keycloak"
}