Skip to main content

FastAPI Keycloak Extended

Project description

FastAPI Keycloak Integration


Welcome to fastapi-keycloak. This projects goal is to ease the integration of Keycloak (OpenID Connect) with Python, especially FastAPI. FastAPI is not necessary but is encouraged due to specific features. Currently, this package supports only the password and the authorization_code. However, the get_current_user() method accepts any JWT that was signed using Keycloak´s private key.

Docs

Refer to https://fastapi-keycloak.code-specialist.com/.

Adding some features:

  • KeycloakToken with more datas (refresh token, expires_in, etc.)
  • KeycloakRefreshToken represents the response after refresh token
  • KeycloakGroup with field attributes
  • Function to retrieve groups by attribute
  • Update call api GET (for users and groups) with param briefRepresentation as false. This allows to get the full representation of the object.
  • Update create_user and create_group
  • Function to refresh token
  • Override user_login to take an account more details
  • Update OIDCUser to add field from attributes

This exposes all fastapi_keycloak features under fastapi_keycloak_extended.

Keycloak version

Module tested with version of keycloak:

  • 16.0 (server uri must end with /auth )
  • 22.0

Build and publish

Refer to https://packaging.python.org/en/latest/tutorials/packaging-projects/

Step:

  • python -m build
  • python -m twine upload --repository pypi dist/*

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

fastapi_keycloak_extended-1.0.10.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file fastapi_keycloak_extended-1.0.10.1.tar.gz.

File metadata

File hashes

Hashes for fastapi_keycloak_extended-1.0.10.1.tar.gz
Algorithm Hash digest
SHA256 b47ff24c2c911522381f82c61bf53b3eaa33d33b1282550d1541933a5509c355
MD5 f84c28a558fdd49818f0c061fd64a61d
BLAKE2b-256 4716a078f84a70ad6c3c9437ea4401e820ea0a1e2ad24675a5aabd72270dbfa9

See more details on using hashes here.

File details

Details for the file fastapi_keycloak_extended-1.0.10.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_keycloak_extended-1.0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe0b448829b33629806dff40f3b0187a2bab110271d08530ce2643fb566d2743
MD5 93e774130f6b841c6cbdac487aae25aa
BLAKE2b-256 ebedf0a7dc778f233243b34f981adb4c7d88b663e2703af330413d0633938e59

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