Only filter out failing openid providers if multiple are configured and one of them failed

This commit is contained in:
kolaente 2021-05-16 13:28:15 +02:00
parent b76ad8efe2
commit 20ede346b4
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -17,6 +17,7 @@
package openid package openid
import ( import (
"code.vikunja.io/api/pkg/log"
"context" "context"
"regexp" "regexp"
"strconv" "strconv"
@ -48,7 +49,11 @@ func GetAllProviders() (providers []*Provider, err error) {
provider, err := getProviderFromMap(pi) provider, err := getProviderFromMap(pi)
if err != nil { if err != nil {
return nil, err if provider != nil {
log.Errorf("Error while getting openid provider %s: %s", provider.Name, err)
}
log.Errorf("Error while getting openid provider: %s", err)
continue
} }
providers = append(providers, provider) providers = append(providers, provider)
@ -119,7 +124,7 @@ func getProviderFromMap(pi map[interface{}]interface{}) (*Provider, error) {
var err error var err error
provider.OpenIDProvider, err = oidc.NewProvider(context.Background(), provider.AuthURL) provider.OpenIDProvider, err = oidc.NewProvider(context.Background(), provider.AuthURL)
if err != nil { if err != nil {
return nil, err return provider, err
} }
provider.Oauth2Config = &oauth2.Config{ provider.Oauth2Config = &oauth2.Config{