Enable JWT Auth
All checks were successful
Create Release & Upload Assets / Upload Assets To Gitea w/ goreleaser (push) Successful in 2m30s

This commit is contained in:
2025-01-12 20:41:49 -06:00
parent e02d88f266
commit eb1d69465f
16 changed files with 853 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
fifo "github.com/foize/go.fifo"
sentryecho "github.com/getsentry/sentry-go/echo"
"github.com/golang-jwt/jwt/v5"
"github.com/labstack/echo-jwt/v4"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"golang.org/x/time/rate"
@@ -84,17 +85,15 @@ func StartEcho(server chan bool, webserver_addr string, webserver_port int) {
api_v1 := e.Group("/api/v1")
// Echo JWT - Won't accept valid keys? Bug To-Do
/*
api_v1.Use(echojwt.WithConfig(echojwt.Config{
SigningKey: []byte(config.JWT_Secret),
SigningMethod: "HS256",
TokenLookup: "header:Authorization:Bearer ,query:token, param:token",
ContextKey: "User",
NewClaimsFunc: func(c echo.Context) jwt.Claims {
return new(jwtCustomClaims)
},
}))
*/
api_v1.Use(echojwt.WithConfig(echojwt.Config{
SigningKey: []byte(config.JWT_Secret),
SigningMethod: "HS256",
TokenLookup: "header:Authorization:Bearer ,query:token, param:token",
ContextKey: "User",
NewClaimsFunc: func(c echo.Context) jwt.Claims {
return new(jwtCustomClaims)
},
}))
api_v1.POST("/print", func(c echo.Context) error {