2024-05-17 17:29:26 +02:00
|
|
|
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/network"
|
|
|
|
"forge.cadoles.com/cadoles/bouncer/internal/schema"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
extended, err := schema.Extend(authn.RawLayerOptionsSchema, network.RawLayerOptionsSchema)
|
|
|
|
if err != nil {
|
|
|
|
panic(errors.Wrap(err, "could not extend authn base layer options schema"))
|
|
|
|
}
|
|
|
|
|
|
|
|
RegisterLayer(network.LayerType, setupAuthnNetworkLayer, extended)
|
|
|
|
}
|
|
|
|
|
|
|
|
func setupAuthnNetworkLayer(conf *config.Config) (director.Layer, error) {
|
|
|
|
options := []authn.OptionFunc{
|
|
|
|
authn.WithTemplateDir(string(conf.Layers.Authn.TemplateDir)),
|
2024-06-05 15:46:59 +02:00
|
|
|
authn.WithDebug(bool(conf.Layers.Authn.Debug)),
|
2024-05-17 17:29:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return network.NewLayer(options...), nil
|
|
|
|
}
|