Skip to content

API Reference

This section documents the internal Python API of the SuperSaaS Auth Connector. Most users only need to interact with the application via environment variables — see the Configuration page.

Application (sac.app)

sac.app

Main application file for the SuperSaaS authentication connector.

catchall_page(_)

Redirect to /supersaas for user creation and redirection to SuperSaaS.

Source code in sac/app.py
def catchall_page(_: Request) -> Response:  # pragma: no cover
    """Redirect to /supersaas for user creation and redirection to SuperSaaS."""
    return RedirectResponse(url="/supersaas")

logout_redirect(_)

Logout user by redirecting to logout URL (front-channel logout).

Source code in sac/app.py
def logout_redirect(_: Request) -> Response:
    """Logout user by redirecting to logout URL (front-channel logout)."""
    return RedirectResponse(url=settings.LOGOUT_REDIRECT_URL)

main()

Run the application with Uvicorn.

Source code in sac/app.py
def main() -> None:  # pragma: no cover
    """Run the application with Uvicorn."""
    # Configure SuperSaaS client
    Client.configure(
        api_key=settings.SUPERSAAS_API_TOKEN,
        account_name=settings.SUPERSAAS_ACCOUNT_NAME,
    )
    uvicorn.run(app, host=settings.HOST, port=settings.PORT)

supersaas_redirect(request)

Create user in SuperSaaS if not exists and redirect to SuperSaaS login URL.

Source code in sac/app.py
def supersaas_redirect(request: Request) -> Response:
    """Create user in SuperSaaS if not exists and redirect to SuperSaaS login URL."""
    name = request.state.user.get("email")
    _create_user(name=name, user_id=request.state.user.get("uid"))
    return RedirectResponse(url=_generate_supersaas_login_url(name))

Settings (sac.settings)

sac.settings

Settings for the SuperSaaS Auth Connector application.