added csrf
This commit is contained in:
+5
-2
@@ -2,6 +2,7 @@ package routes
|
||||
|
||||
import (
|
||||
"authentication/handlers"
|
||||
"authentication/middleware"
|
||||
"database/sql"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
@@ -16,9 +17,11 @@ func SetupRoutes(router *mux.Router, db *sql.DB) {
|
||||
authRoutes := router.PathPrefix("/v1/auth").Subrouter()
|
||||
authRoutes.HandleFunc("/login", handlers.GoogleLogin).Methods("GET")
|
||||
authRoutes.HandleFunc("/callback", handlers.GoogleCallback).Methods("GET")
|
||||
authRoutes.HandleFunc("/refresh_token", handlers.HandleTokenRefresh).Methods("GET", "POST", "OPTIONS")
|
||||
authRoutes.HandleFunc("/logout", handlers.LogoutHandler).Methods("GET")
|
||||
authRoutes.HandleFunc("/forgot-password", handlers.ForgotPassword).Methods("GET")
|
||||
csrfProtected := authRoutes.NewRoute().Subrouter()
|
||||
csrfProtected.Use(middleware.CSRFMiddleware)
|
||||
csrfProtected.HandleFunc("/refresh_token", handlers.HandleTokenRefresh).Methods("POST", "OPTIONS")
|
||||
csrfProtected.HandleFunc("/logout", handlers.LogoutHandler).Methods("POST")
|
||||
|
||||
// authRoutes.HandleFunc("/microsoft/login", handlers.MicrosoftLogin).Methods("GET")
|
||||
// authRoutes.HandleFunc("/microsoft/callback", handlers.MicrosotCallback).Methods("GET")
|
||||
|
||||
Reference in New Issue
Block a user