Identity & Access
In productionSSO 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
(open full-size SSO Portal screenshot)
(open full-size SSO Portal screenshot)
(open full-size SSO Portal screenshot)
(open full-size SSO Portal screenshot)
(open full-size SSO Portal screenshot)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.
Corporate User
Route Guard
Next.js proxy that verifies the session JWT, its expiry and the device fingerprint on every portal page.
Portal UI
Login, password recovery and a role-filtered app launcher, built with Zustand, Radix UI and EN/ID translations.
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.
Identity Rate Limiter
Lockout and progressive delay per account identity, tuned separately for login and password recovery.
Bank Identity API
Corporate Apps (SCF, CMS)
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
}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
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