01Das Versprechen
„Ich bau mal schnell das Login."
Das ist der Satz, mit dem jedes zweite SaaS-Disaster beginnt. Authentifizierung sieht einfach aus. User hat Email und Passwort, etwas Session-Management, fertig. Drei Tage Arbeit, denkst du.
In Wahrheit hast du gerade einen der schwierigsten Bereiche der Softwareentwicklung betreten. Und es ist nicht die Kryptografie, die dich versenkt. Es sind die zehn Dinge, an die du noch nicht gedacht hast.
02Was du eigentlich brauchst
Die Liste, die drei Tage Arbeit zu drei Monaten macht.
Damit „Login" in Produktion sicher läuft, brauchst du:
- Passwort-Hashing mit bcrypt oder Argon2, nicht mit SHA-256
- Session-Management mit sicheren, HttpOnly-SameSite-Cookies
- JWT-Generierung, Key-Rotation und Refresh-Token-Flow
- Brute-Force-Schutz, Rate-Limiting und Account-Lockout
- Passwort-Reset mit sicherem Email-Flow und Expiry
- Email-Verifizierung beim Sign-Up
- MFA mit TOTP, SMS und Backup-Codes
- Passkey-Support, erwartet seit 2024
- Social-Login über Google, Apple und andere IdPs
- „Auf allen Geräten abmelden" als Self-Service
- Audit-Log für Compliance und Forensik
- FADP- und DSGVO-konforme Datenhaltung
Jeder einzelne Punkt hat eine Liste von Sicherheitslücken, die du nicht siehst, bis sie ausgenutzt werden. Jeder kostet Wochen. Das ist nicht das Produkt, das du bauen wolltest.
03Der AWS-Stack, drei Schichten
Drei Services, jeder für eine klare Aufgabe.
- Layer 1 · Amazon Cognito Identity Provider für Registrierung, Login, MFA, Passkeys. OAuth2 und OIDC out of the box. User Pools für die Benutzerdatenbank, Identity Pools für AWS-Credentials. Hosted UI optional, Custom UI möglich.
- Layer 2 · Lambda@Edge Token-Validierung bevor die Request das Backend erreicht. Cognito-JWTs werden am CloudFront-Edge geprüft, ungültige Tokens sofort abgewiesen. Die Origin sieht nie eine unauthentifizierte Request.
- Layer 3 · API Gateway Autorisierung auf API-Ebene. Der Cognito Authorizer ist nativ integriert. Rate-Limiting, Throttling, WAF-Integration kommen gratis dazu.
Defense in Depth, nicht als Buzzword, sondern als saubere Arbeitsteilung: Identity bei Cognito, Network-Level-Blocking am Edge, API-Level-Autorisierung im Gateway.
04In Produktion bei SCMC
Swiss Cybersecurity-Plattform. FADP-konform. Seit November 2025 live.
Ich habe diesen Stack für SCMC.ch gebaut. FADP-Compliance war Must-have, nicht Nice-to-have. Nach über fünf Monaten in Produktion:
- Keine Auth-Session-Bugs in Produktion
- Passkeys seit Tag 1
- Audit-Log kommt aus CloudTrail und Cognito-Events, nicht aus eigenem Code
- Feature-Entwicklung statt Security-Firefighting
05Die Regel
Baue nie, was du kaufen kannst. Besonders nicht bei Security.
Die einzige legitime Ausnahme: du bist selbst Identity-Provider-Hersteller. Keycloak, Auth0, Okta, Clerk, Supabase Auth, Firebase Auth sind alle grosse Investitionen über viele Jahre. Das baut man nicht nebenbei.
Auf AWS und keine Identity-Firma? Die Antwort ist Cognito. Self-Hosting oder On-Prem nötig? Dann Keycloak, OAuth2, SAML, Passkeys, LDAP, alles RFC-konform. In beiden Fällen: nicht selber bauen.
Deine Wochen gehören in das Produkt, das niemand anders bauen kann.
Serverless & Cloud Security
Auth sauber aufsetzen, ohne Wochen zu verlieren.
Ich baue diesen Stack für Swiss SMEs und AWS-Beratungen. Architektur-Review, CDK-Baseline, Produktions-Setup.
Gespräch buchen →01The promise
"I'll just quickly build the login."
That's the sentence that starts every other SaaS disaster. Authentication looks simple. User has an email and a password, a bit of session management, done. Three days of work, you think.
In reality, you've just entered one of the hardest areas of software. And it's not cryptography that sinks you. It's the ten things you haven't thought of yet.
02What you actually need
The list that turns three days of work into three months.
For "login" to run safely in production, you need:
- Password hashing with bcrypt or Argon2, not SHA-256
- Session management with secure, HttpOnly, SameSite cookies
- JWT issuance, key rotation, and a refresh token flow
- Brute-force protection, rate limiting, and account lockout
- Password reset with a secure email flow and expiry
- Email verification at sign-up
- MFA with TOTP, SMS, and backup codes
- Passkey support, expected since 2024
- Social login via Google, Apple, and other IdPs
- "Sign out of all devices" as a self-service
- Audit log for compliance and forensics
- FADP and GDPR-compliant data handling
Every single item has a list of vulnerabilities you will not see until they're exploited. Every one costs weeks. That's not the product you wanted to build.
03The AWS stack, three layers
Three services, each for a clear job.
- Layer 1 · Amazon Cognito Identity provider for sign-up, login, MFA, passkeys. OAuth2 and OIDC out of the box. User Pools for the user database, Identity Pools for AWS credentials. Hosted UI optional, custom UI possible.
- Layer 2 · Lambda@Edge Token validation before the request reaches the backend. Cognito JWTs are checked at the CloudFront edge, invalid tokens rejected immediately. The origin never sees an unauthenticated request.
- Layer 3 · API Gateway Authorization at the API layer. The Cognito Authorizer is natively integrated. Rate limiting, throttling, WAF integration come for free.
Defense in depth, not as a buzzword, but as clean separation of concerns: identity at Cognito, network-level blocking at the edge, API-level authorization in the gateway.
04In production at SCMC
Swiss cybersecurity platform. FADP-compliant. Live since November 2025.
I built this stack for SCMC.ch. FADP compliance was must-have, not nice-to-have. After more than five months in production:
- No auth session bugs in production
- Passkeys from day one
- Audit log comes from CloudTrail and Cognito events, not from my own code
- Feature development instead of security firefighting
05The rule
Never build what you can buy. Especially not for security.
The only legitimate exception: you are an identity provider vendor yourself. Keycloak, Auth0, Okta, Clerk, Supabase Auth, Firebase Auth are all massive multi-year investments. You don't build that on the side.
On AWS and you are not an identity company? The answer is Cognito. Self-hosting or on-prem needed? Then Keycloak: OAuth2, SAML, passkeys, LDAP, all RFC-compliant. Either way, do not build it yourself.
Your weeks belong in the product only you can build.
Serverless & Cloud Security
Auth done right, without losing weeks.
I build this stack for Swiss SMEs and AWS consultancies. Architecture review, CDK baseline, production setup.
Book a call →