FastAPI KeyCloak Middleware

This package provides a middleware for FastAPI that simplifies integrating with Keycloak for authentication and authorization. It supports OIDC and supports validating access tokens, reading roles and basic authentication. In addition it provides several decorators and dependencies to easily integrate into your FastAPI application.

It relies on the python-keycloak package, which is the only dependency outside of the FastAPI ecosystem which would be installed anyway. Shoutout to the author of fastapi-auth-middleware which served as inspiration for this package and some of its code.

In the future, I plan to add support for fine grained authorization using Keycloak Authorization services.

Indices and tables