bouncer/internal/setup/authn_basic_layer.go
William Petit d5fed4c2ac
Some checks reported errors
Cadoles/bouncer/pipeline/head Something is wrong with the build of this commit
feat(authn): add templatized error page
ref CNOUS/mse#3907
2024-06-05 15:53:17 +02:00

29 lines
906 B
Go

package setup
import (
"forge.cadoles.com/cadoles/bouncer/internal/config"
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director"
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director/layer/authn"
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director/layer/authn/basic"
"forge.cadoles.com/cadoles/bouncer/internal/schema"
"github.com/pkg/errors"
)
func init() {
extended, err := schema.Extend(authn.RawLayerOptionsSchema, basic.RawLayerOptionsSchema)
if err != nil {
panic(errors.Wrap(err, "could not extend authn base layer options schema"))
}
RegisterLayer(basic.LayerType, setupAuthnBasicLayer, extended)
}
func setupAuthnBasicLayer(conf *config.Config) (director.Layer, error) {
options := []authn.OptionFunc{
authn.WithTemplateDir(string(conf.Layers.Authn.TemplateDir)),
authn.WithDebug(bool(conf.Layers.Authn.Debug)),
}
return basic.NewLayer(options...), nil
}