...

Source file src/edge-infra.dev/pkg/edge/iam/pin/pin.go

Documentation: edge-infra.dev/pkg/edge/iam/pin

     1  package pin
     2  
     3  import (
     4  	"github.com/gin-gonic/gin"
     5  	"github.com/gorilla/sessions"
     6  
     7  	"edge-infra.dev/pkg/edge/iam/profile"
     8  	"edge-infra.dev/pkg/edge/iam/prometheus"
     9  	"edge-infra.dev/pkg/edge/iam/util"
    10  )
    11  
    12  var (
    13  	reqPIN    = "pin"
    14  	signInPin = "sign_in_pin"
    15  	signUpPin = "sign_up_pin"
    16  )
    17  
    18  type PIN struct {
    19  	storage        Storage
    20  	profileStorage profile.Storage
    21  	sessionStore   sessions.Store
    22  	metrics        *prometheus.Metrics
    23  }
    24  
    25  func NewPIN(router *gin.Engine, sessionStore sessions.Store, storage interface{}, metrics *prometheus.Metrics) *PIN {
    26  	pin := &PIN{
    27  		storage:        storage.(Storage),
    28  		profileStorage: storage.(profile.Storage),
    29  		sessionStore:   sessionStore,
    30  		metrics:        metrics,
    31  	}
    32  
    33  	router.POST("/idp/set/pin", util.MakeHandlerFunc(pin.savePIN))
    34  	router.POST("/idp/login/pin", util.MakeHandlerFunc(pin.login))
    35  
    36  	return pin
    37  }
    38  

View as plain text