added fetching of origin in auth login

This commit is contained in:
2026-03-05 10:09:12 +08:00
parent 8f51faeb12
commit 30c91cf5c8
6 changed files with 319 additions and 76 deletions
+5 -3
View File
@@ -15,9 +15,11 @@ func SetupRoutes(router *mux.Router, db *sql.DB) {
router.HandleFunc("/ready", handlers.ReadyHandler).Methods("GET")
authRoutes := router.PathPrefix("/v1/auth").Subrouter()
authRoutes.HandleFunc("/login", handlers.GoogleLogin).Methods("GET")
authRoutes.HandleFunc("/callback", handlers.GoogleCallback).Methods("GET")
authRoutes.HandleFunc("/forgot-password", handlers.ForgotPassword).Methods("GET")
frontendOnly := authRoutes.NewRoute().Subrouter()
frontendOnly.Use(middleware.FrontendOriginWhitelist)
frontendOnly.HandleFunc("/login", handlers.GoogleLogin).Methods("GET")
frontendOnly.HandleFunc("/forgot-password", handlers.ForgotPassword).Methods("GET")
frontendOnly.HandleFunc("/callback", handlers.GoogleCallback).Methods("GET")
csrfProtected := authRoutes.NewRoute().Subrouter()
csrfProtected.Use(middleware.CSRFMiddleware)