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.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for keycloak_basic-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd5b924bf53d68792a487e1201a1ace62db54ae5e108c7b285c44268d4590013 |
|
MD5 | 2063a0489ec377b502f4bbf5e2ba630b |
|
BLAKE2b-256 | 05bb919cc1dcd7e15747927f46421d4b404e634007974d158d5c2d2951797360 |