Skip to main content

FastAPI integration with Keycloak for authentication and role-based access control

Project description

fastapi-keycloak-auth

fastapi-keycloak-auth is a Python package that provides an easy integration of Keycloak authentication and role-based authorization into FastAPI applications. The package supports JWT token validation, role checks, and automatic token retrieval, making it simple to implement secure API access.

Features:

  • Keycloak Integration: Authenticate and retrieve JWT tokens from Keycloak using the password grant type.
  • Token Verification: Easily verify the JWT token with Keycloak's public key.
  • Role-based Access Control: Enforce role-based access with custom decorators.
  • Flexible Configuration: Easily configure Keycloak settings (URL, realm, client ID, username, and password) via environment variables or direct updates.

Installation:

You can install the package via pip:

pip install fastapi-keycloak-auth

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_auth_lib-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_keycloak_auth_lib-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_keycloak_auth_lib-0.1.0.tar.gz.

File metadata

File hashes

Hashes for fastapi_keycloak_auth_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a45d47b1a06303a0b74db8b00da13a721e3e1089c790818591d336fd913532ac
MD5 812315e468e0b03c28904bd4622520b1
BLAKE2b-256 35b76945ae3c7f3eaf0885f6d0dc78a6e3059beee62c38b7f5145c999b427610

See more details on using hashes here.

File details

Details for the file fastapi_keycloak_auth_lib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_keycloak_auth_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a237d551fdc9131e2bdf0469b95aa819f6bcb236052768cb31b212a2ca04152
MD5 e09d6fd7655c40a7dde9901fae52f816
BLAKE2b-256 5d984c1cc713d0cee94d130c80b3e61675362280d6654ceac1ed8677366e5048

See more details on using hashes here.

Supported by

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