feat(auth): Add /token endpoint to request a access token

This commit is contained in:
Björn Benouarets
2026-01-27 16:37:19 +01:00
parent d8241a2491
commit b57c2511e9
4 changed files with 9 additions and 2 deletions

View File

@@ -14,10 +14,12 @@ import (
func AuthMiddleware() fiber.Handler {
return func(c *fiber.Ctx) error {
if slices.Contains(config.CONFIG.UnprotectedEndpoints, c.Path()) {
tokenEndpoint := "/token"
if slices.Contains(config.CONFIG.UnprotectedEndpoints, c.Path()) || c.Path() == tokenEndpoint {
masterlog.Debug("Unprotected endpoint", map[string]interface{}{"path": c.Path()})
return c.Next()
}
authHeader := c.Get("Authorization")
if authHeader == "" {
masterlog.Debug("No token provided", map[string]interface{}{"path": c.Path(), "authorization": c.Get("Authorization")})