feat(auth): Add option to disable registration and tenant creation

This commit is contained in:
Björn Benouarets
2026-01-27 16:34:04 +01:00
parent 9d7adb740c
commit 4e49896319
9 changed files with 126 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
package controllers
import (
"git.secnex.io/secnex/auth-api/config"
"git.secnex.io/secnex/auth-api/services"
"git.secnex.io/secnex/auth-api/utils"
"github.com/go-playground/validator/v10"
@@ -16,6 +17,11 @@ type RegisterRequest struct {
}
func RegisterController(c *fiber.Ctx) error {
if !config.CONFIG.AllowRegistration {
return utils.NewErrorResponse(fiber.StatusForbidden, &fiber.Map{
"message": "Registration is not allowed",
}).Send(c)
}
var request RegisterRequest
if err := c.BodyParser(&request); err != nil {
return utils.NewErrorResponse(fiber.StatusBadRequest, &fiber.Map{