feat(auth): Add /token endpoint to request a access token
This commit is contained in:
@@ -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")})
|
||||
|
||||
Reference in New Issue
Block a user