aboutsummaryrefslogtreecommitdiffstats
path: root/backend/internal/api/handlers/auth_handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/internal/api/handlers/auth_handlers.go')
-rw-r--r--backend/internal/api/handlers/auth_handlers.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/backend/internal/api/handlers/auth_handlers.go b/backend/internal/api/handlers/auth_handlers.go
new file mode 100644
index 0000000..18d8a1a
--- /dev/null
+++ b/backend/internal/api/handlers/auth_handlers.go
@@ -0,0 +1,38 @@
+package handlers
+
+import (
+ "finance/backend/internal/api/auth"
+ "finance/backend/internal/config"
+
+ "github.com/gin-gonic/gin"
+)
+
+// AuthHandler handles authentication-related operations
+type AuthHandler struct {
+ config *config.Config
+}
+
+// NewAuthHandler creates and returns a new AuthHandler instance
+func NewAuthHandler(cfg *config.Config) *AuthHandler {
+ return &AuthHandler{
+ config: cfg,
+ }
+}
+
+// Register handles user registration
+func (h *AuthHandler) Register(c *gin.Context) {
+ // Delegate to the existing auth.Signup handler
+ auth.Signup(h.config)(c)
+}
+
+// Login handles user authentication
+func (h *AuthHandler) Login(c *gin.Context) {
+ // Delegate to the existing auth.Login handler
+ auth.Login(h.config)(c)
+}
+
+// JWTAuth middleware validates JWT tokens
+func (h *AuthHandler) JWTAuth(c *gin.Context) {
+ // Delegate to the existing auth.AuthMiddleware
+ auth.AuthMiddleware(h.config)(c)
+}