parcoursmob/handlers/auth/auth.go

33 lines
981 B
Go

package auth
import (
"git.coopgo.io/coopgo-apps/parcoursmob/renderer"
"git.coopgo.io/coopgo-apps/parcoursmob/services"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
cache "git.coopgo.io/coopgo-apps/parcoursmob/utils/storage"
"git.coopgo.io/coopgo-platform/emailing"
"github.com/spf13/viper"
)
type AuthHandler struct {
idp *identification.IdentificationProvider
config *viper.Viper
services *services.ServicesHandler
Renderer *renderer.Renderer
cache cache.CacheHandler
emailing *emailing.Mailer
}
func NewAuthHandler(cfg *viper.Viper, idp *identification.IdentificationProvider, svc *services.ServicesHandler, cache cache.CacheHandler, emailing *emailing.Mailer) (*AuthHandler, error) {
templates_root := cfg.GetString("templates.root")
renderer := renderer.NewRenderer(cfg, templates_root)
return &AuthHandler{
idp: idp,
config: cfg,
services: svc,
Renderer: renderer,
cache: cache,
emailing: emailing,
}, nil
}