package pin import ( "github.com/gin-gonic/gin" "github.com/gorilla/sessions" "edge-infra.dev/pkg/edge/iam/profile" "edge-infra.dev/pkg/edge/iam/prometheus" "edge-infra.dev/pkg/edge/iam/util" ) var ( reqPIN = "pin" signInPin = "sign_in_pin" signUpPin = "sign_up_pin" ) type PIN struct { storage Storage profileStorage profile.Storage sessionStore sessions.Store metrics *prometheus.Metrics } func NewPIN(router *gin.Engine, sessionStore sessions.Store, storage interface{}, metrics *prometheus.Metrics) *PIN { pin := &PIN{ storage: storage.(Storage), profileStorage: storage.(profile.Storage), sessionStore: sessionStore, metrics: metrics, } router.POST("/idp/set/pin", util.MakeHandlerFunc(pin.savePIN)) router.POST("/idp/login/pin", util.MakeHandlerFunc(pin.login)) return pin }