From 9147e6739fb228b7b5f689322e948c6619d16b08 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 9 Jun 2021 23:00:42 +0200 Subject: [PATCH] Fix authentication callback --- pkg/modules/auth/openid/openid.go | 17 +++++++++-------- pkg/modules/auth/openid/providers.go | 9 +++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pkg/modules/auth/openid/openid.go b/pkg/modules/auth/openid/openid.go index f5835097..b2dc5d45 100644 --- a/pkg/modules/auth/openid/openid.go +++ b/pkg/modules/auth/openid/openid.go @@ -46,13 +46,14 @@ type Callback struct { // Provider is the structure of an OpenID Connect provider type Provider struct { - Name string `json:"name"` - Key string `json:"key"` - AuthURL string `json:"auth_url"` - ClientID string `json:"client_id"` - ClientSecret string `json:"-"` - openIDProvider *oidc.Provider - Oauth2Config *oauth2.Config `json:"-"` + Name string `json:"name"` + Key string `json:"key"` + OriginalAuthURL string `json:"-"` + AuthURL string `json:"auth_url"` + ClientID string `json:"client_id"` + ClientSecret string `json:"-"` + openIDProvider *oidc.Provider + Oauth2Config *oauth2.Config `json:"-"` } type claims struct { @@ -67,7 +68,7 @@ func init() { } func (p *Provider) setOicdProvider() (err error) { - p.openIDProvider, err = oidc.NewProvider(context.Background(), p.AuthURL) + p.openIDProvider, err = oidc.NewProvider(context.Background(), p.OriginalAuthURL) return err } diff --git a/pkg/modules/auth/openid/providers.go b/pkg/modules/auth/openid/providers.go index 8db4da0a..bd75c751 100644 --- a/pkg/modules/auth/openid/providers.go +++ b/pkg/modules/auth/openid/providers.go @@ -119,10 +119,11 @@ func getProviderFromMap(pi map[string]interface{}) (provider *Provider, err erro k := getKeyFromName(name) provider = &Provider{ - Name: pi["name"].(string), - Key: k, - AuthURL: pi["authurl"].(string), - ClientSecret: pi["clientsecret"].(string), + Name: pi["name"].(string), + Key: k, + AuthURL: pi["authurl"].(string), + OriginalAuthURL: pi["authurl"].(string), + ClientSecret: pi["clientsecret"].(string), } cl, is := pi["clientid"].(int)