Fix not token secret

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-29 11:45:49 +01:00
parent 1cdf005087
commit 63abfe3698
6 changed files with 10 additions and 12 deletions

View File

@@ -36,13 +36,13 @@ func APIKeyFromContext(ctx context.Context) *coredata.PersonalAPIKey {
return apiKey
}
func NewAPIKeyMiddleware(svc *iam.Service) func(next http.Handler) http.Handler {
func NewAPIKeyMiddleware(svc *iam.Service, tokenSecret string) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
tokenValue, err := securetoken.Get(r, "")
tokenValue, err := securetoken.Get(r, tokenSecret)
if err != nil {
next.ServeHTTP(w, r)
return