Files
wonderwall/pkg/mock/config.go
Trong Huu Nguyen 1906024da0 feat(openid/acr): remove old values and backward compatibility for new idporten
We no longer expect nor accept tokens with old acr values during
validation as ID-porten no longer issues tokens with these values.

This also removes backward compatibility in cases where configured
values targeted the new ID-porten while using old ID-porten.

We still maintain an internal mapping from old values to new values
for forward compatibilty when using old values provided in the login
parameter and the `openid.acr-values` flag.
2024-06-27 12:34:16 +02:00

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 key
Ingresses: []string{Ingress},
OpenID: config.OpenID{
ACRValues: "idporten-loa-high",
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
}