parent
32c021e2b3
commit
20af034d78
1 changed files with 10 additions and 1 deletions
|
@ -31,6 +31,10 @@ import (
|
||||||
|
|
||||||
// GetAllProviders returns all configured providers
|
// GetAllProviders returns all configured providers
|
||||||
func GetAllProviders() (providers []*Provider, err error) {
|
func GetAllProviders() (providers []*Provider, err error) {
|
||||||
|
if !config.AuthOpenIDEnabled.GetBool() {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
ps, err := keyvalue.Get("openid_providers")
|
ps, err := keyvalue.Get("openid_providers")
|
||||||
if err != nil && kerr.IsErrValueNotFoundForKey(err) {
|
if err != nil && kerr.IsErrValueNotFoundForKey(err) {
|
||||||
rawProviders := config.AuthOpenIDProviders.Get()
|
rawProviders := config.AuthOpenIDProviders.Get()
|
||||||
|
@ -92,7 +96,12 @@ func getKeyFromName(name string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getProviderFromMap(pi map[interface{}]interface{}) (*Provider, error) {
|
func getProviderFromMap(pi map[interface{}]interface{}) (*Provider, error) {
|
||||||
k := getKeyFromName(pi["name"].(string))
|
name, is := pi["name"].(string)
|
||||||
|
if !is {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
k := getKeyFromName(name)
|
||||||
|
|
||||||
provider := &Provider{
|
provider := &Provider{
|
||||||
Name: pi["name"].(string),
|
Name: pi["name"].(string),
|
||||||
|
|
Loading…
Reference in a new issue