All Projects

Identity & Access

In production

SSO Portal

One secure sign-in for a bank's corporate customers: log in once, then open the financing and cash management apps their role allows.

Senior Frontend Developer at Bank Saqu · August 2024 - August 2026

Private bank codebase. Screens are from the de-branded demo build, which runs against a bundled mock identity API.

100+

Corporate Users

2

Apps Behind One Sign-In

0

Backend Secrets in the Browser

EN / ID

Bilingual Sign-In

At a Glance

Problem
Auth logic was spread across many REST routes, which made it hard to audit and harden.
What I built
A GraphQL gateway that is the only API the browser calls, plus login, lockout, password self-service and SSO handoff.
Result
One audited entry point serving 100+ corporate users across 2 apps.

Screens

Sign-in tour. Open the portal, try a wrong password (generic error), sign in, and land on the role-filtered launcher. Recorded on the de-branded demo build with its mock identity API, no sound.
Portal sign-in page with Company ID, email and password fields and an English/Indonesian language switch (open full-size SSO Portal screenshot)
Sign-in, with the English / Indonesian switch in the header.
App launcher after sign-in showing Supply Chain Financing and Cash Management cards with a role selector (open full-size SSO Portal screenshot)
After sign-in, each user sees only the apps their roles allow, then opens one through a signed handoff.
Diagram: route guard, portal UI, GraphQL gateway, identity API, with lockout, session cookie and SSO handoff (open full-size SSO Portal screenshot)
Structure: the browser calls one gateway endpoint; the gateway signs every call to the identity service.
Sign-in page showing a Login Failed toast that does not say whether the company, user or password was wrong (open full-size SSO Portal screenshot)
A failed sign-in says only that something was wrong, never which field, so it cannot be used to find valid accounts.
Password recovery form asking for Company ID and email address (open full-size SSO Portal screenshot)
Password recovery: its own rate-limit profile, tuned separately from login.

The Problem

Corporate customers needed one secure entry point to the bank's financing and cash management apps, but auth logic was spread across many REST routes, making it hard to audit and harden.

My Role

Built the portal and its GraphQL gateway (BFF): authentication, sessions, lockout, the password lifecycle, request signing and the SSO handoff.

Architecture

A backend-for-frontend: pages are guarded at the edge, and the browser calls one GraphQL endpoint whose resolvers sign every call to the bank's identity service.

  1. Corporate User

  2. Route Guard

    Next.js proxy that verifies the session JWT, its expiry and the device fingerprint on every portal page.

  3. Portal UI

    Login, password recovery and a role-filtered app launcher, built with Zustand, Radix UI and EN/ID translations.

  4. GraphQL Gateway (BFF)

    GraphQL Yoga endpoint, the only API the browser calls. Login and password recovery are public; every other operation checks the session in its resolver.

  5. Identity Rate Limiter

    Lockout and progressive delay per account identity, tuned separately for login and password recovery.

  6. Bank Identity API

  7. Corporate Apps (SCF, CMS)

Page request
Valid session
GraphQL operations
Check / record attempts
Signed, TLS-verified HTTPS
Signed SSO handoff

Engineering Decisions

  • GraphQL gateway as the BFF

    One audited, browser-facing surface with per-operation auth, instead of many REST route handlers.

    Trade-off A GraphQL layer to maintain, and auth is checked per resolver, so every new operation has to call the session check.

  • Keep NextAuth's cookie format

    Minted the session cookie byte-compatible with NextAuth, so middleware and session hooks didn't need rewriting.

    Trade-off The login mutation has to mirror NextAuth's own cookie-naming rules.

  • Fingerprint as a signal, not a boundary

    Kept the device fingerprint to catch copied cookies and device switches, documented as not a security boundary.

    Trade-off It flags accidental cookie copies and device switches, but it is not replay protection, and the code says so.

What I Built

  • Replaced many REST route handlers with one GraphQL Yoga gateway, keeping backend URLs, client secrets and request signing server-side.
  • Implemented login as a mutation that mints a NextAuth-compatible cookie, so existing middleware and session hooks kept working.
  • Built lockout with progressive delay keyed on account identity (Company ID + User ID) instead of a spoofable client IP.
  • Implemented password recovery and change, single-active-session rules, and a heartbeat that logs out locked accounts.
  • Built the role-filtered app launcher and signed SSO handoff, centralized TLS verification, and derived the CSP from configured origins.

Constraints

  • Backend endpoints, client secrets and signing logic could never reach the browser.
  • Existing NextAuth-based middleware and the downstream apps' SSO contract had to keep working.

Outcome

Every browser request now goes through one GraphQL endpoint with identity-keyed lockout and signed, TLS-verified backend calls, serving 100+ users. 9 of 11 tracked security items were closed.

For Engineers

47

Automated Tests Passing

1

Browser-Facing Endpoint

9 of 11

Security Items Closed

2

Lockout Profiles (Login, Recovery)

Lockout keyed on the account, not the IP

lib/serverRateLimit.ts

function getRateLimitKey(clientIp: string, action: string, identity?: string): string {
  const normalizedIdentity = normalizeRateLimitIdentity(identity);
  // x-forwarded-for is client-supplied. Keying on the IP lets an attacker
  // rotate a fake IP per request and get a fresh lockout bucket each time.
  // When we know which account is targeted, lock that account instead.
  return normalizedIdentity
    ? `${action}:${normalizedIdentity}`
    : `ip:${clientIp}:${action}`; // fallback when there's no identity
}
The first version keyed lockout on IP + account, which a rotating X-Forwarded-For header could bypass. Keying on the account closes that gap.

Quality & Security

  • Session cookies are httpOnly, SameSite=Lax and Secure over HTTPS.
  • All outbound calls share one HTTPS agent with TLS verification on; the insecure override only works in development.
  • Content Security Policy built from the configured backend origins, plus HSTS, X-Frame-Options DENY and nosniff headers.
  • Calls to the identity service are signed with SHA-256 over a canonical JSON body.
  • 42 Vitest unit tests cover the account lockout, device fingerprint, request signing, and a guard that fails if any protected GraphQL operation can be called without a session.
  • 5 Playwright end-to-end tests run the real sign-in, role-filtered app launcher, sign-out and a logged-out GraphQL call against the bundled mock identity API, so QA and demos don't need bank access.

Technology

Next.jsTypeScriptGraphQL YogaNextAuth.jsZustandRadix UITailwind CSSAxiosWeb Crypto APIDocker

For Clients

Need one secure front door for several web apps?

What I can build for you, based on this project:

  • Branded login, password reset and session expiry behind a server-side gateway
  • A role-based app launcher with single sign-on handoff to each app
  • Brute-force protection and lockout tuned to your security policy
  • A mock identity backend so QA and demos run without production access

Downloads