Keycloak API for management
Project description
KeycloakAPIManager
API for Keycloak management
CLIENT_ID = "test_client_name"
REALM_NAME = "realm_name"
CLIENT_SECRET = "40j32-5860-4d79-ad16-9c39897w083"
USERNAME = "username@gmail.com" - User name with admin's rules
PASSWORD = "f232@3s456S#422"
SERVER_URL = "http://localhost:8080/auth/" - url keykcloak server
Installation
pip install keycloak-api-manager
Example
Create it
Create a file main.py
with:
from keycloak_api_manager import KeycloakAPIManager
CLIENT_ID = "test_client_name"
REALM_NAME = "realm_name"
CLIENT_SECRET = "40j32-5860-4d79-ad16-9c39897w083"
USERNAME = 'username@gmail.com' # KEYCLOAK user's USERNAME or EMAIL User with admin's
PASSWORD = 'f232@3s456S#422'
SERVER_URL = "http://localhost:8080/auth/" # KEYCLOAK URL http://localhost:8080/auth/ or
# http://server_url/auth/
keycloak_api = KeycloakAPIManager(keycloak_url=SERVER_URL, realm_name=REALM_NAME,
client_id=CLIENT_ID, client_secret=CLIENT_SECRET,
admin_username=USERNAME, admin_password=PASSWORD)
about_me = keycloak_api.get_info_about_me()
print(about_me)
Run it
Run a file: main.py
Create user
Method Create_user with parameter payload
create_user(payload=payload)
payload = {
"username": "some_user",
"attributes": {"phoneNumber": "1234567890"}, # optional field
"enabled": True,
"credentials": [{"temporary": False, "value": "raw_password"}]
}
Editing user
Method Update_user with parameter payload and user_id
update_user(payload=payload_update, user_id="090798-bdaf-4bfb-969b-efc862eaa")
payload_update = {
"attributes": {
"phoneNumber": "1234567890",
"testKey": "testValue"
}
}
All functions see on page Documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file keycloak_api_manager-1.0.1.tar.gz
.
File metadata
- Download URL: keycloak_api_manager-1.0.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b10809311b1ed4aef8e40e79d380ac6fb0db28fea111286e066743691619dea |
|
MD5 | f5c42b45b6d5dbceec2ee55ba19e526a |
|
BLAKE2b-256 | 6adb457f0b631624d2f200a4793e05087930957aa389ed1e5304568af18e97e9 |
File details
Details for the file keycloak_api_manager-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: keycloak_api_manager-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a87d3cb53b709f35b1dfb3bce5cece28b005aef79b098e8a8060c86faf621adb |
|
MD5 | e8c2a62e54b9f743f0e0f2e1344d6b3d |
|
BLAKE2b-256 | 7f0aef61910c5baf320fa0d7c7c622cedf67a7c3a9f196c85a76a01d4c41a7f5 |