Liquidity Docs

Integrating an app with Liquid IAM

Every Liquidity app authenticates through one Liquid IAM instance and shares the

Every Liquidity app authenticates through one Liquid IAM instance and shares the liquidity organization, while exposing its own surface. This is the model plus the two reference integrations.

The model

  • Organization liquidity - the namespace for users and applications.
  • Application - one per app (e.g. transfer-agent): clientId, clientSecret, redirectUris, grantTypes (authorization_code, refresh_token), linked providers, signinItems, enablePassword, branding (logo, formCss, footerHtml).
  • Provider - the upstream IdP (e.g. google-satschel): type=Google, OAuth client credentials, scopes, and the emailRegex domain gate.

Application id is {owner}/{name} (e.g. admin/transfer-agent). The browser authenticates against {issuer}/login/oauth/authorize?client_id=..; the backend verifies the resulting JWT against {issuer}/.well-known/jwks.

Onboard a new app

  1. Create the Application in the liquidity org (admin console or API):
    • assign clientId (+ clientSecret for confidential/backend use),
    • set grantTypes = [authorization_code, refresh_token],
    • add redirectUris = the app's /callback for each origin (local + hosted),
    • add each origin root to the post-logout redirect URIs,
    • link the google-satschel provider (canSignUp/canSignIn = true),
    • set enablePassword=false for SSO-only.
  2. Point the app's OIDC client at this issuer with the app's clientId, org liquidity, app name, scope openid profile email.
  3. Verify tokens on the backend against the issuer's JWKS.

The seed-sso.py script does steps 1-2 for the transfer-agent app; adapt APP_NAME to provision another.

Reference integration A - browser SPA (Transfer Agent console)

Uses casdoor-js-sdk for the PKCE flow.

VITE_OIDC_ISSUER=http://localhost:8000
VITE_OIDC_CLIENT_ID=<transfer-agent client id>
VITE_OIDC_APP_NAME=transfer-agent
VITE_OIDC_ORG_NAME=liquidity
  • SDK config: serverUrl=issuer, clientId, appName, organizationName, redirectPath=/callback, scope="openid profile email", storage = sessionStorage.
  • Login redirects with location.replace (so the login page is not a back-reachable history entry); tokens are kept in sessionStorage.
  • Logout calls /api/logout with id_token_hint + post_logout_redirect_uri so IAM redirects cleanly back to the app.

Reference integration B - backend service (ta-api, subledger-api)

Uses coreos/go-oidc.

TA_OIDC_ISSUER_URL=http://localhost:8000
TA_OIDC_CLIENT_ID=<transfer-agent client id>
  • On boot, builds an ID-token verifier from the issuer's discovery + JWKS.
  • Middleware requires Authorization: Bearer <jwt> on protected routes; public paths (health/readiness/metrics/SSE) bypass it.
  • The verified identity becomes the maker/checker actor; empty issuer disables auth (dev mode, X-Actor-Id header instead).

Roadmap: roles / superadmin

Casdoor supports organizations, roles, and permissions. To add RBAC (e.g. a superadmin surface), define the role in the liquidity org, assert it as a JWT claim, and enforce it per-route on the backend (and hide/show admin-only UI on the frontend). The identity extraction point already exists in the backend auth middleware.