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.0.tar.gz
.
File metadata
- Download URL: keycloak_api_manager-1.0.0.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 | 0b4dad6b31bc477139ed2aab0fcbe36e0e8403abb6e1d72400ad25160acd9009 |
|
MD5 | f7f9478169d5435e3e721171fede4e00 |
|
BLAKE2b-256 | 4d36171a932ce5ffd53123718b91ed713e5411fcfb84e191983434d0cd04139e |
File details
Details for the file keycloak_api_manager-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: keycloak_api_manager-1.0.0-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 | 328323de0b4ef33513e80cb45eba92bb776780fce77b38282d6bd6ca6842a02d |
|
MD5 | 783344c43259b9edf445b78048053270 |
|
BLAKE2b-256 | f12b0e7992e4b140081fed5bc1e44c6daa6334d101f0c70ae009cf52c6ae4541 |