mirror of
https://github.com/nais/wonderwall.git
synced 2026-08-19 11:06:17 +00:00
Fail at startup rather than on the first token request when the identity provider does not accept the client assertion algorithm. The check is skipped when the provider omits the field, which is optional in Discovery.
43 lines
757 B
Go
43 lines
757 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
|
|
wonderwallconfig "github.com/nais/wonderwall/pkg/config"
|
|
)
|
|
|
|
type Config interface {
|
|
Client() Client
|
|
Provider() Provider
|
|
}
|
|
|
|
type openidconfig struct {
|
|
clientConfig Client
|
|
providerConfig Provider
|
|
}
|
|
|
|
func (c *openidconfig) Client() Client {
|
|
return c.clientConfig
|
|
}
|
|
|
|
func (c *openidconfig) Provider() Provider {
|
|
return c.providerConfig
|
|
}
|
|
|
|
func NewConfig(ctx context.Context, cfg *wonderwallconfig.Config) (Config, error) {
|
|
clientCfg, err := NewClientConfig(cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
providerCfg, err := NewProviderConfig(ctx, cfg, clientCfg.ClientJWKAlgorithm())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &openidconfig{
|
|
clientConfig: clientCfg,
|
|
providerConfig: providerCfg,
|
|
}, nil
|
|
}
|