Skip to main content

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

Quickstart

Create a file keycloak_test.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'
PASSWORD = 'f232@3s456S#422'
SERVER_URL = "http://localhost:8080/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 a file: python keycloak_test.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 и user_id
update_user(payload=payload_update, user_id="090798-bdaf-4bfb-969b-efc862eaa")

payload_update = {
    "attributes": {
        "phoneNumber": "1234567890",
        "testKey": "testValue"
    }
}

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

keycloak_api_manager-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

keycloak_api_manager-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file keycloak_api_manager-0.1.1.tar.gz.

File metadata

  • Download URL: keycloak_api_manager-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for keycloak_api_manager-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ef41606208f10bd0cb3f63257863de652fb261c0247a175cb7926a1c68e153d4
MD5 086471c7faaa811940f7c23124b3e8ae
BLAKE2b-256 2229fcc4972cfd3a31c489acb258be793b9a5484d1e785e6838f868e5d3d4d50

See more details on using hashes here.

File details

Details for the file keycloak_api_manager-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for keycloak_api_manager-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bb3663db300a54cbe97b15986b0c04eb14c37b3642ea83c8b7bbd11ea3a981
MD5 92dde8ef1d4d85d4b73b7ac6baafeec7
BLAKE2b-256 f0cbffe4fdc38946287daf33861575128e75e293aa1272f7c736dafe763fed3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page