Keycloak Authenticator
Project description
Keycloak-Basic
All the libraries I found for Keycloak are outdated and not nearly generic enough, so here's a new one.
Documentation
Installing
python -m pip install keycloak-basic
Usage
from keycloak import Keycloak, AccessToken, UserInfo
keycloak: Keycloak = Keycloak(
"http(s)://<host>:<port>", # Keycloak server URL with no trailing path
"<realm name>", # Name of realm to authenticate in
"<client id>", # Client ID
client_secret = "<client secret" # Client secret, if present
)
token: AccessToken = keycloak.login(
"<username>", # User username
"<password>" # User password
) -> AccessToken
keycloak.authenticated # Boolean, true if logged in
keycloak.isScoped("scope") -> bool # True if current token has scope
info: UserInfo = keycloak.userinfo() -> UserInfo object
keycloak.refresh() -> AccessToken # Refreshes connection
keycloak.logout() # Logs out
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-basic-1.1.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for keycloak_basic-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa8bc197d41c3a2da68849f892c2ad519e93b95f3b3065947d105a8e3205ac1 |
|
MD5 | 8dd79ed80811b7cf792476d1c97f0f31 |
|
BLAKE2b-256 | 49439cb1ba2abc9ed55dee8907aefc26ecb92d81f7033224e91326e9b3054692 |