🐛 Fix auth context middleware force provide token
This commit is contained in:
parent
421834ae5c
commit
999cc2bcd8
@ -6,6 +6,10 @@ import (
|
||||
|
||||
func ContextMiddleware(c *fiber.Ctx) error {
|
||||
atk := tokenExtract(c)
|
||||
if len(atk) == 0 {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
c.Locals("nex_in_token", atk)
|
||||
|
||||
if claims, err := tokenRead(atk); err == nil && claims != nil {
|
||||
|
@ -8,8 +8,6 @@ import (
|
||||
)
|
||||
|
||||
func MapAPIs(app *fiber.App) {
|
||||
app.Use(auth.ContextMiddleware)
|
||||
|
||||
// Some built-in public-accessible APIs
|
||||
wellKnown := app.Group("/.well-known").Name("Well Known")
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/internal/auth"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/internal/http/api"
|
||||
"github.com/goccy/go-json"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@ -42,6 +43,8 @@ func NewServer() *HTTPApp {
|
||||
Output: log.Logger,
|
||||
}))
|
||||
|
||||
app.Use(auth.ContextMiddleware)
|
||||
|
||||
api.MapAPIs(app)
|
||||
|
||||
return &HTTPApp{app}
|
||||
|
Loading…
Reference in New Issue
Block a user