30 lines
857 B
Go
30 lines
857 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/cache"
|
||
|
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
|
||
|
"github.com/spf13/viper"
|
||
|
)
|
||
|
|
||
|
type AuthHandler struct {
|
||
|
idp *identification.IdentificationProvider
|
||
|
config *viper.Viper
|
||
|
services *services.ServicesHandler
|
||
|
Renderer *renderer.Renderer
|
||
|
cache *cache.CacheHandler
|
||
|
}
|
||
|
|
||
|
func NewAuthHandler(cfg *viper.Viper, idp *identification.IdentificationProvider, svc *services.ServicesHandler, cache *cache.CacheHandler) (*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,
|
||
|
}, nil
|
||
|
}
|