mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-09 18:06:42 +00:00
There's a bunch of changes here, but in essence: - split out openid configuration - separate openid configuration between client/rp and provider - consolidate client and provider related code in separate packages These changes allow for simplification of the Handler, as well as a bunch of test/mock code as the configuration is now instantiated seperately from the client/provider code.
79 lines
1.8 KiB
Go
79 lines
1.8 KiB
Go
package mock
|
|
|
|
import (
|
|
"github.com/lestrrat-go/jwx/v2/jwk"
|
|
|
|
"github.com/nais/wonderwall/pkg/config"
|
|
"github.com/nais/wonderwall/pkg/crypto"
|
|
"github.com/nais/wonderwall/pkg/openid/scopes"
|
|
)
|
|
|
|
type TestClientConfiguration struct {
|
|
ClientID string
|
|
ClientJWK jwk.Key
|
|
CallbackURI string
|
|
LogoutCallbackURI string
|
|
PostLogoutRedirectURI string
|
|
Scopes scopes.Scopes
|
|
ACRValues string
|
|
UILocales string
|
|
WellKnownURL string
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetCallbackURI() string {
|
|
return c.CallbackURI
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetClientID() string {
|
|
return c.ClientID
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetClientJWK() jwk.Key {
|
|
return c.ClientJWK
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetLogoutCallbackURI() string {
|
|
return c.LogoutCallbackURI
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetPostLogoutRedirectURI() string {
|
|
return c.PostLogoutRedirectURI
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetScopes() scopes.Scopes {
|
|
return c.Scopes
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetACRValues() string {
|
|
return c.ACRValues
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetUILocales() string {
|
|
return c.UILocales
|
|
}
|
|
|
|
func (c TestClientConfiguration) GetWellKnownURL() string {
|
|
return c.WellKnownURL
|
|
}
|
|
|
|
func (c TestClientConfiguration) Print() {}
|
|
|
|
func clientConfiguration(cfg *config.Config) *TestClientConfiguration {
|
|
key, err := crypto.NewJwk()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return &TestClientConfiguration{
|
|
ClientID: cfg.OpenID.ClientID,
|
|
ClientJWK: key,
|
|
CallbackURI: "http://localhost/callback",
|
|
LogoutCallbackURI: "http://localhost/logout/callback",
|
|
WellKnownURL: "",
|
|
UILocales: "nb",
|
|
ACRValues: "Level4",
|
|
PostLogoutRedirectURI: "",
|
|
Scopes: scopes.DefaultScopes(),
|
|
}
|
|
}
|