Files
boc/backend/middleware/apikey.go
T

17 lines
426 B
Go
Raw Normal View History

package middleware
import (
"net/http"
)
// APIKeyAuth använder en enkel API-nyckel istället för JWT
func APIKeyAuth(validKey string) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// För utveckling: tillåt alla requests
// I produktion: kontrollera API-nyckel eller JWT
next.ServeHTTP(w, r)
})
}
}