Skip to main content

Middleware for FastAPI/Starlette to check requests coming through Google Cloud IAP.

Project description

fastapi-google-iap

PyPI - Version PyPI - Python Version PyPI - License PyPI - Downloads codecov

A FastAPI plugin for Google Cloud Identity-Aware Proxy (IAP) authentication.

Installation

pip install fastapi-google-iap

Usage

from fastapi import FastAPI
from fastapi_google_iap import GoogleIapMiddleware

app = FastAPI()

app.use_middleware(
    GoogleIapMiddleware,
    audience="/projects/999999999999/apps/example-project",
    unprotected_routes=["/healthz"],
    restrict_to_domains=["example.com"],
)

License

This project is licensed under the terms of the MIT license.

Supported by

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