How multiservices-psi/authentication_backend works
This is a Spring Boot authentication API. Clients register or sign in with username/email and password, or authenticate with a Google ID token; successful flows return an internal JWT. Subsequent protected requests present that token for validation and user loading. The graph also includes the local credential lookup and Google verification branches. Security configuration and protected-route behavior are described in the README, but their implementation was not sampled, so wiring beyond the documented filter/security roles is omitted.
Main entry points: AuthService.java Local auth service · AuthGoogleService.java Google auth service · AuthController.java Auth controller · JwtAutenticationFilter.java JWT filter
Components 17
Authentication API
- Auth controller
src/main/java/promo67/login/invent/auth/AuthController.java - Local auth service
src/main/java/promo67/login/invent/auth/AuthService.java - Google auth service
src/main/java/promo67/login/invent/auth/AuthGoogleService.java - Exception handler
src/main/java/promo67/login/invent/exception/GlobalExceptionHandler.java
Identity and tokens
- Google token verifier
src/main/java/promo67/login/invent/jwt/GoogleTokenVerifierService.java - JWT service
src/main/java/promo67/login/invent/jwt/JwtService.java
Request security
- JWT filter
src/main/java/promo67/login/invent/jwt/JwtAutenticationFilter.java - Security configuration
src/main/java/promo67/login/invent/config/SecurityConfig.java - Auth provider setup
src/main/java/promo67/login/invent/config/ApplicationConfig.java - Authentication manager
src/main/java/promo67/login/invent/config/ApplicationConfig.java - User details lookup
src/main/java/promo67/login/invent/config/ApplicationConfig.java - Password encoder
src/main/java/promo67/login/invent/config/ApplicationConfig.java
User persistence
- User repository
src/main/java/promo67/login/invent/models/UserRepository.java - User model
src/main/java/promo67/login/invent/models/User.java - MySQL database
src/main/resources/application.properties
Other components
- API client
- Google identity
Connections 25
- API client → Auth controller: sends auth request
- Auth controller → Local auth service: dispatches local auth
- Auth controller → Google auth service: dispatches Google auth
- Local auth service → Authentication manager: authenticates credentials
- Local auth service → User repository: checks and saves user
- Local auth service → Password encoder: hashes password
- Local auth service → JWT service: issues JWT
- Google auth service → Google token verifier: verifies ID token
- Google token verifier → Google identity: checks token
- Google auth service → User repository: finds or saves user
- Google auth service → Password encoder: hashes generated password
- Google auth service → JWT service: issues JWT
- JWT service → Auth controller: returns token
- User repository → MySQL database: reads and writes users
- Authentication manager → User details lookup: loads principal
- User details lookup → User repository: looks up username or email
- Auth provider setup → Authentication manager: provides bean
- Auth provider setup → User details lookup: provides bean
- Auth provider setup → Password encoder: provides BCrypt bean
- Security configuration → JWT filter: configures filter
- API client → JWT filter: sends bearer token
- JWT filter → JWT service: validates token
- JWT filter → User details lookup: loads token user
- JWT filter → Security configuration: continues secured request
- Auth controller → Exception handler: raises handled errors