Refactor auth handler into separate account handler
This commit is contained in:
@@ -10,19 +10,19 @@ import (
|
||||
|
||||
func setupProtectedRoutes(rg *gin.RouterGroup, webApp *app.WebApp) {
|
||||
jwtSecret := []byte(webApp.Config.JWT.Secret)
|
||||
authHandler := handler.NewAuthHandler(webApp.AuthService)
|
||||
accountHandler := handler.NewAccountHandler(webApp.AuthService)
|
||||
|
||||
rg.Use(middleware.AuthRequired(jwtSecret))
|
||||
|
||||
account := rg.Group("/account")
|
||||
{
|
||||
account.GET("", authHandler.GetAccount)
|
||||
account.GET("", accountHandler.GetAccount)
|
||||
|
||||
passkeys := account.Group("/passkeys")
|
||||
{
|
||||
passkeys.GET("", authHandler.ListPasskeys)
|
||||
passkeys.POST("", authHandler.CreatePasskey)
|
||||
passkeys.DELETE("/:id", authHandler.RevokePasskey)
|
||||
passkeys.GET("", accountHandler.ListPasskeys)
|
||||
passkeys.POST("", accountHandler.CreatePasskey)
|
||||
passkeys.DELETE("/:id", accountHandler.RevokePasskey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user