wip
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 1m8s

This commit is contained in:
2025-12-25 07:36:58 +01:00
parent 1c091dc924
commit aaddb84144
23 changed files with 379 additions and 366 deletions

View File

@@ -3,12 +3,12 @@ package middleware
import (
"context"
"net/http"
"spend-sparrow/internal/authentication"
"spend-sparrow/internal/core"
"spend-sparrow/internal/service"
"strings"
)
func Authenticate(service service.Auth) func(http.Handler) http.Handler {
func Authenticate(service authentication.Service) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@@ -31,7 +31,7 @@ func Authenticate(service service.Auth) func(http.Handler) http.Handler {
return
}
cookie := CreateSessionCookie(session.Id)
cookie := core.CreateSessionCookie(session.Id)
http.SetCookie(w, &cookie)
}

View File

@@ -3,8 +3,8 @@ package middleware
import (
"log/slog"
"net/http"
"spend-sparrow/internal/authentication"
"spend-sparrow/internal/core"
"spend-sparrow/internal/service"
"spend-sparrow/internal/utils"
"strings"
)
@@ -31,7 +31,7 @@ func (rr *csrfResponseWriter) Write(data []byte) (int, error) {
return rr.ResponseWriter.Write([]byte(dataStr))
}
func CrossSiteRequestForgery(auth service.Auth) func(http.Handler) http.Handler {
func CrossSiteRequestForgery(auth authentication.Service) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()