add new options to tests
This commit is contained in:
parent
84024355e2
commit
a1773a1eed
2 changed files with 9 additions and 5 deletions
|
@ -257,7 +257,7 @@ func NewForwardedOpenIDProvider(path string, config *Config, storage Storage, op
|
||||||
// op.AuthCallbackURL(provider) which is probably /callback. On the redirect back
|
// op.AuthCallbackURL(provider) which is probably /callback. On the redirect back
|
||||||
// to the AuthCallbackURL, the request id should be passed as the "id" parameter.
|
// to the AuthCallbackURL, the request id should be passed as the "id" parameter.
|
||||||
func NewProvider(config *Config, storage Storage, issuer func(insecure bool) (IssuerFromRequest, error), opOpts ...Option) (_ *Provider, err error) {
|
func NewProvider(config *Config, storage Storage, issuer func(insecure bool) (IssuerFromRequest, error), opOpts ...Option) (_ *Provider, err error) {
|
||||||
keySet := &openIDKeySet{storage}
|
keySet := &OpenIDKeySet{storage}
|
||||||
o := &Provider{
|
o := &Provider{
|
||||||
config: config,
|
config: config,
|
||||||
storage: storage,
|
storage: storage,
|
||||||
|
@ -469,13 +469,13 @@ func (o *Provider) HttpHandler() http.Handler {
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
type openIDKeySet struct {
|
type OpenIDKeySet struct {
|
||||||
Storage
|
Storage
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifySignature implements the oidc.KeySet interface
|
// VerifySignature implements the oidc.KeySet interface
|
||||||
// providing an implementation for the keys stored in the OP Storage interface
|
// providing an implementation for the keys stored in the OP Storage interface
|
||||||
func (o *openIDKeySet) VerifySignature(ctx context.Context, jws *jose.JSONWebSignature) ([]byte, error) {
|
func (o *OpenIDKeySet) VerifySignature(ctx context.Context, jws *jose.JSONWebSignature) ([]byte, error) {
|
||||||
keySet, err := o.Storage.KeySet(ctx)
|
keySet, err := o.Storage.KeySet(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error fetching keys: %w", err)
|
return nil, fmt.Errorf("error fetching keys: %w", err)
|
||||||
|
|
|
@ -58,8 +58,12 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTestProvider(config *op.Config) op.OpenIDProvider {
|
func newTestProvider(config *op.Config) op.OpenIDProvider {
|
||||||
provider, err := op.NewOpenIDProvider(testIssuer, config,
|
storage := storage.NewStorage(storage.NewUserStore(testIssuer))
|
||||||
storage.NewStorage(storage.NewUserStore(testIssuer)), op.WithAllowInsecure(),
|
keySet := &op.OpenIDKeySet{storage}
|
||||||
|
provider, err := op.NewOpenIDProvider(testIssuer, config, storage,
|
||||||
|
op.WithAllowInsecure(),
|
||||||
|
op.WithAccessTokenKeySet(keySet),
|
||||||
|
op.WithIDTokenHintKeySet(keySet),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue