Update internal/middleware/auth.go
Browse files
internal/middleware/auth.go
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
package middleware
|
2 |
|
3 |
import (
|
|
|
4 |
"monica-proxy/internal/config"
|
5 |
"net/http"
|
6 |
"strings"
|
@@ -25,10 +26,11 @@ func BearerAuth() echo.MiddlewareFunc {
|
|
25 |
|
26 |
// 验证token
|
27 |
if token != config.MonicaConfig.BearerToken || token == "" {
|
|
|
28 |
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
|
29 |
}
|
30 |
|
31 |
return next(c)
|
32 |
}
|
33 |
}
|
34 |
-
}
|
|
|
1 |
package middleware
|
2 |
|
3 |
import (
|
4 |
+
"log"
|
5 |
"monica-proxy/internal/config"
|
6 |
"net/http"
|
7 |
"strings"
|
|
|
26 |
|
27 |
// 验证token
|
28 |
if token != config.MonicaConfig.BearerToken || token == "" {
|
29 |
+
log.Printf("invalid token: %s", token)
|
30 |
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
|
31 |
}
|
32 |
|
33 |
return next(c)
|
34 |
}
|
35 |
}
|
36 |
+
}
|