Fix authentication callback
This commit is contained in:
parent
570d146b21
commit
9147e6739f
2 changed files with 14 additions and 12 deletions
|
@ -46,13 +46,14 @@ type Callback struct {
|
||||||
|
|
||||||
// Provider is the structure of an OpenID Connect provider
|
// Provider is the structure of an OpenID Connect provider
|
||||||
type Provider struct {
|
type Provider struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
AuthURL string `json:"auth_url"`
|
OriginalAuthURL string `json:"-"`
|
||||||
ClientID string `json:"client_id"`
|
AuthURL string `json:"auth_url"`
|
||||||
ClientSecret string `json:"-"`
|
ClientID string `json:"client_id"`
|
||||||
openIDProvider *oidc.Provider
|
ClientSecret string `json:"-"`
|
||||||
Oauth2Config *oauth2.Config `json:"-"`
|
openIDProvider *oidc.Provider
|
||||||
|
Oauth2Config *oauth2.Config `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type claims struct {
|
type claims struct {
|
||||||
|
@ -67,7 +68,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) setOicdProvider() (err error) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,11 @@ func getProviderFromMap(pi map[string]interface{}) (provider *Provider, err erro
|
||||||
k := getKeyFromName(name)
|
k := getKeyFromName(name)
|
||||||
|
|
||||||
provider = &Provider{
|
provider = &Provider{
|
||||||
Name: pi["name"].(string),
|
Name: pi["name"].(string),
|
||||||
Key: k,
|
Key: k,
|
||||||
AuthURL: pi["authurl"].(string),
|
AuthURL: pi["authurl"].(string),
|
||||||
ClientSecret: pi["clientsecret"].(string),
|
OriginalAuthURL: pi["authurl"].(string),
|
||||||
|
ClientSecret: pi["clientsecret"].(string),
|
||||||
}
|
}
|
||||||
|
|
||||||
cl, is := pi["clientid"].(int)
|
cl, is := pi["clientid"].(int)
|
||||||
|
|
Loading…
Reference in a new issue