From fdeb4e318cdf5e3db3533e0c0c00cd8f9d3b0b96 Mon Sep 17 00:00:00 2001 From: David Sharnoff Date: Wed, 20 Jul 2022 18:11:03 -0700 Subject: [PATCH] undo more gofumpt changes --- pkg/client/client.go | 21 ++++++++++++--------- pkg/client/rp/relying_party.go | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index d6d27f7..ccc3cc0 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -15,17 +15,20 @@ import ( "github.com/zitadel/oidc/pkg/oidc" ) -var Encoder = func() httphelper.Encoder { - e := schema.NewEncoder() - e.RegisterEncoder(oidc.SpaceDelimitedArray{}, func(value reflect.Value) string { - return value.Interface().(oidc.SpaceDelimitedArray).Encode() - }) - return e -}() +var ( + Encoder = func() httphelper.Encoder { + e := schema.NewEncoder() + e.RegisterEncoder(oidc.SpaceDelimitedArray{}, func(value reflect.Value) string { + return value.Interface().(oidc.SpaceDelimitedArray).Encode() + }) + return e + }() +) -// Discover calls the discovery endpoint of the provided issuer and returns its configuration -// It accepts an optional argument "wellknownUrl" which can be used to overide the dicovery endpoint url +//Discover calls the discovery endpoint of the provided issuer and returns its configuration +//It accepts an optional argument "wellknownUrl" which can be used to overide the dicovery endpoint url func Discover(issuer string, httpClient *http.Client, wellKnownUrl ...string) (*oidc.DiscoveryConfiguration, error) { + wellKnown := strings.TrimSuffix(issuer, "/") + oidc.DiscoveryEndpoint if len(wellKnownUrl) == 1 && wellKnownUrl[0] != "" { wellKnown = wellKnownUrl[0] diff --git a/pkg/client/rp/relying_party.go b/pkg/client/rp/relying_party.go index 2af54be..cbeb264 100644 --- a/pkg/client/rp/relying_party.go +++ b/pkg/client/rp/relying_party.go @@ -236,14 +236,14 @@ func WithVerifierOpts(opts ...VerifierOption) Option { } } -//WithClientKey specifies the path to the key.json to be used for the JWT Profile Client Authentication on the token endpoint +// WithClientKey specifies the path to the key.json to be used for the JWT Profile Client Authentication on the token endpoint // //deprecated: use WithJWTProfile(SignerFromKeyPath(path)) instead func WithClientKey(path string) Option { return WithJWTProfile(SignerFromKeyPath(path)) } -//WithJWTProfile creates a signer used for the JWT Profile Client Authentication on the token endpoint +// WithJWTProfile creates a signer used for the JWT Profile Client Authentication on the token endpoint func WithJWTProfile(signerFromKey SignerFromKey) Option { return func(rp *relyingParty) error { signer, err := signerFromKey()