mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-11 02:47:05 +00:00
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package mock
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/nais/wonderwall/pkg/config"
|
|
"github.com/nais/wonderwall/pkg/ingress"
|
|
openidconfig "github.com/nais/wonderwall/pkg/openid/config"
|
|
)
|
|
|
|
const (
|
|
Ingress = "http://wonderwall"
|
|
)
|
|
|
|
func Config() *config.Config {
|
|
return &config.Config{
|
|
EncryptionKey: `G8Roe6AcoBpdr5GhO3cs9iORl4XIC8eq`, // 256 bits AES
|
|
Ingresses: []string{Ingress},
|
|
OpenID: config.OpenID{
|
|
ACRValues: "Level4",
|
|
ClientID: "client-id",
|
|
PostLogoutRedirectURI: "https://google.com",
|
|
Provider: "test",
|
|
Scopes: []string{"some-scope"},
|
|
UILocales: "nb",
|
|
},
|
|
Session: config.Session{
|
|
MaxLifetime: time.Hour,
|
|
},
|
|
}
|
|
}
|
|
|
|
type TestConfiguration struct {
|
|
TestClient *TestClientConfiguration
|
|
TestProvider *TestProviderConfiguration
|
|
}
|
|
|
|
func (c *TestConfiguration) Client() openidconfig.Client {
|
|
return c.TestClient
|
|
}
|
|
|
|
func (c *TestConfiguration) Provider() openidconfig.Provider {
|
|
return c.TestProvider
|
|
}
|
|
|
|
func NewTestConfiguration(cfg *config.Config) *TestConfiguration {
|
|
return &TestConfiguration{
|
|
TestClient: clientConfiguration(cfg),
|
|
TestProvider: providerConfiguration(cfg),
|
|
}
|
|
}
|
|
|
|
func Ingresses(cfg *config.Config) *ingress.Ingresses {
|
|
parsed, err := ingress.ParseIngresses(cfg)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return parsed
|
|
}
|