How line/line-fido2-server works
Project Type & Purpose
• This is a modular, multi-module Java/Spring Boot project providing:
• A FIDO2 (WebAuthn) Server implementation (certified by FIDO Alliance)
• A “relying party” demo server (RP Server) that fronts the WebAuthn flows
• Underlying common message models and core domain logic provided as libraries
• Key use case: Registration and Authentication of users via FIDO2 authenticators.
File Structure
• Top-level modules:
• common: Shared message/domain classes (DTOs) used by both servers
• fido2-core: Core FIDO2 logic (challenge generation, attestation verification, COSE processing); no persistence
• fido2-demo/base: Spring Data JPA layer (entities, repos, services) wired on top of fido2-core
• fido2-demo/demo: Spring Boot application exposing FIDO2 REST endpoints, using base module
• rpserver: Spring Boot “relying party” demo with static front-end, controllers, adapters to call the FIDO2 server
• Cross-cutting:
• docker-compose.yml to spin up rpserver + demo
• Data stores: MySQL/H2 for user credentials & metadata, Redis for session/challenge storage
• External: FIDO Alliance Metadata Service (MDSv3) for metadata certificate fetch
README Insights
• Modules and dependencies are explicitly listed
• Technologies: Spring Boot 2.7, Java 11, Spring Data JPA, H2/MySQL, Redis, Spring REST Docs, Swagger
• Features: multiple attestation types, MDS integration, optional Android/iOS origin checks
Main Components & Interactions
a. Components:
1. Web Client (Browser or Mobile using WebAuthn API)
2. RP Server (rpserver module) – serves static UI, handles initial user requests, proxies to FIDO2 Server
3. FIDO2 Server (fido2-demo/demo module):
• Controllers → Services → Repositories
• Depends on fido2-demo/base for JPA and fido2-core for domain logic
4. Relational DB (H2/MySQL) – stores UserKeyEntity, Metadata, RP info
5. Redis – stores session state / challenge data
6. External MDSv3 Service – FIDO Alliance metadata endpoint
7. Common Library (common module) – message definitions shared by both servers
8. Core Library (fido2-core module) – challenge/attestation logic
b. Relationships:
• Web Client ↔ RP Server (HTTPS, REST)
• RP Server ↔ FIDO2 Server (HTTPS, REST, using common DTOs)
• FIDO2 Server → Redis (for challenges)
• FIDO2 Server → RDB (for credentials, metadata)
• FIDO2 Server → External MDSv3 (HTTP fetch of metadata TOC & certificates)
• All server modules depend on common; demo depends on base, which depends on core
c. Architectural Patterns & Principles:
• Layered (Controller → Service → Repository) within each Spring Boot app
• Modularization: clear separation of domain logic (core), persistence (base), shared messages (common), and runtime apps (demo & rpserver)
• Hexagonal/Library style for fido2-core (no direct I/O)
• API Gateway-style proxy: RP Server fronts the flow
d. Technologies/Frameworks:
• Java 11, Spring Boot (2.7.x)
• Spring MVC, Spring Data JPA, Spring Cache/Redis
• Docker + docker-compose
• Swagger UI, Spring REST Docs
Detailed Yet Focused
• Module’s role: common vs core vs base vs demo vs rpserver
• Runtime vs compile-time dependencies distinctly
• Do not enumerate every class; group by package or module
• Challenge‐response flow (registration & authentication) is obvious
• Two Spring Boot microservices (RP Server & FIDO2 Server)
• The shared libraries feeding into them
• Backing stores (RDB, Redis) and external metadata service
• Web client interaction
• Data flows and dependency directions