bouncer/internal/setup/authn_oidc_layer.go

28 lines
909 B
Go
Raw Normal View History

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/adapter/redis"
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director/layer/authn/oidc"
"forge.cadoles.com/cadoles/bouncer/internal/schema"
"github.com/pkg/errors"
)
func init() {
extended, err := schema.Extend(authn.RawLayerOptionsSchema, oidc.RawLayerOptionsSchema)
if err != nil {
panic(errors.Wrap(err, "could not extend authn base layer options schema"))
}
RegisterLayer(oidc.LayerType, setupAuthnOIDCLayer, extended)
}
func setupAuthnOIDCLayer(conf *config.Config) (director.Layer, error) {
rdb := newRedisClient(conf.Redis)
adapter := redis.NewStoreAdapter(rdb)
return oidc.NewLayer(adapter), nil
}