2fas-server/internal/websocket/browser_extension/service.go
2023-01-30 19:59:42 +01:00

28 lines
700 B
Go

package browser_extension
import (
"github.com/gin-gonic/gin"
"github.com/twofas/2fas-server/internal/websocket/common"
)
type RoutesHandler struct {
connectionHandler *common.ConnectionHandler
}
func NewRoutesHandler(handler *common.ConnectionHandler) *RoutesHandler {
return &RoutesHandler{
connectionHandler: handler,
}
}
func GinRoutesHandler(routes *RoutesHandler, router *gin.Engine) {
connectionHandler := routes.connectionHandler.Handle()
router.GET("/browser_extensions/:extension_id", connectionHandler)
router.GET("/browser_extensions/:extension_id/2fa_requests/:token_request_id", connectionHandler)
router.GET("/health", func(c *gin.Context) {
c.String(200, "")
})
}