Fix parsing openid config when using a json config file
(Cherry-picked from 570d146b21
)
This commit is contained in:
parent
e837c2a003
commit
65ac7b1fc7
1 changed files with 13 additions and 2 deletions
|
@ -44,7 +44,18 @@ func GetAllProviders() (providers []*Provider, err error) {
|
|||
rawProvider := rawProviders.([]interface{})
|
||||
|
||||
for _, p := range rawProvider {
|
||||
pi := p.(map[interface{}]interface{})
|
||||
var pi map[string]interface{}
|
||||
var is bool
|
||||
pi, is = p.(map[string]interface{})
|
||||
// JSON config is a map[string]interface{}, other providers are not. Under the hood they are all strings so
|
||||
// it is save to cast.
|
||||
if !is {
|
||||
pis := p.(map[interface{}]interface{})
|
||||
pi = make(map[string]interface{}, len(pis))
|
||||
for i, s := range pis {
|
||||
pi[i.(string)] = s
|
||||
}
|
||||
}
|
||||
|
||||
provider, err := getProviderFromMap(pi)
|
||||
if err != nil {
|
||||
|
@ -94,7 +105,7 @@ func getKeyFromName(name string) string {
|
|||
return reg.ReplaceAllString(strings.ToLower(name), "")
|
||||
}
|
||||
|
||||
func getProviderFromMap(pi map[interface{}]interface{}) (*Provider, error) {
|
||||
func getProviderFromMap(pi map[string]interface{}) (*Provider, error) {
|
||||
name, is := pi["name"].(string)
|
||||
if !is {
|
||||
return nil, nil
|
||||
|
|
Loading…
Reference in a new issue