- Add JWT token generation and validation - Implement bcrypt password hashing - Create auth service with register/login/refresh/logout - Add app passkey generation and management - Implement protected routes and auth middleware - Add comprehensive tests for new functionality
23 lines
581 B
Go
23 lines
581 B
Go
package server
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/dhao2001/mygo/internal/app"
|
|
"github.com/dhao2001/mygo/internal/handler"
|
|
)
|
|
|
|
func setupPublicRoutes(rg *gin.RouterGroup, webApp *app.WebApp) {
|
|
versionHandler := handler.NewVersionHandler(webApp.Version)
|
|
rg.GET("/version", versionHandler.Get)
|
|
|
|
authHandler := handler.NewAuthHandler(webApp.AuthService)
|
|
auth := rg.Group("/auth")
|
|
{
|
|
auth.POST("/register", authHandler.Register)
|
|
auth.POST("/login", authHandler.Login)
|
|
auth.POST("/refresh", authHandler.Refresh)
|
|
auth.POST("/logout", authHandler.Logout)
|
|
}
|
|
}
|