Skip to content

Module: cis-bff

cis-bff (Backend-for-Frontend) is the secure API Gateway and user-facing edge proxy that shields the internal microservices from direct browser exposure.


Architectural Role

sequenceDiagram
    autonumber
    actor Browser as User Browser
    participant BFF as cis-bff (:8080)
    participant Redis as Redis Session Store (:6379)
    participant Auth as cis-auth (:8085)
    participant API as cis-api (:8089)

    Browser->>BFF: GET /login (Authorization Code + PKCE)
    BFF->>Auth: Exchange Auth Code for Access/Refresh Tokens
    Auth-->>BFF: JWT Access Token & Refresh Token
    BFF->>Redis: Store Tokens mapped to Secure Session ID
    BFF-->>Browser: Set-Cookie: CIS_SESSION (HttpOnly, Secure, SameSite)

    Note over Browser,BFF: Subsequent API Requests
    Browser->>BFF: GET /api/v1/cadastral/records (Cookie: CIS_SESSION)
    BFF->>Redis: Fetch valid Access Token
    BFF->>API: Reverse Proxy Request with Bearer <JWT>
    API-->>BFF: Cadastral JSON Payload
    BFF-->>Browser: Response JSON Payload

Security Guarantees

  • No Tokens in Browser: Access and refresh tokens are stored exclusively server-side in Redis.
  • CSRF Protection: Stateful double-submit cookie or token verification prevents cross-site request forgery.
  • Session Eviction: Subscribes to Redis Pub/Sub events from cis-auth to immediately invalidate sessions on user logout or credential revocation.
  • Reverse Proxy: Intelligently proxies /api/* endpoints to cis-api and /workflow/* to cis-workflow.