Add functionality for session termination

This commit is contained in:
2024-06-20 18:15:49 +07:00
parent b732262dcd
commit 949099124e
3 changed files with 59 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import (
uploadHandler "github.com/fossyy/filekeeper/handler/upload"
"github.com/fossyy/filekeeper/handler/upload/initialisation"
userHandler "github.com/fossyy/filekeeper/handler/user"
userSessionTerminateHandler "github.com/fossyy/filekeeper/handler/user/session/terminate"
userHandlerTotpSetup "github.com/fossyy/filekeeper/handler/user/totp"
"github.com/fossyy/filekeeper/middleware"
"net/http"
@ -92,6 +93,10 @@ func SetupRoutes() *http.ServeMux {
middleware.Auth(userHandler.GET, w, r)
})
handler.HandleFunc("DELETE /user/session/terminate/{id}", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(userSessionTerminateHandler.DELETE, w, r)
})
handler.HandleFunc("GET /user/totp/setup", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(userHandlerTotpSetup.GET, w, r)
})