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, Token, 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: Token = keycloak.auth(
"<username>", # User username
"<password>" # User password
) -> Token
token.authenticated # Boolean, true if logged in
token.isScoped("scope") -> bool # True if current token has scope
info: UserInfo = token.info() -> UserInfo object
token.refresh() # Refreshes connection
token.logout() # Logs out
keycloak.load_token(token.content) -> Token # Loads token from dict
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.2.0.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for keycloak_basic-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88cca9f614aa5f128295a240279bbfcd8b3d4cfaddfeb49403c585b6f9c8a952 |
|
MD5 | d411ddbb77aa405062746daf08d84106 |
|
BLAKE2b-256 | fda88e0dda723a3cfa9ce82d0938ce15ad1b2ab646dc8117736d8ab3a97e6774 |