28 lines
901 B
Go
28 lines
901 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/oidc"
|
|
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director/layer/authn/redis"
|
|
"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
|
|
}
|