(cfg map[string]config.AuthScheme)
| 12 | } |
| 13 | |
| 14 | func LoadAuthSchemes(cfg map[string]config.AuthScheme) (map[string]AuthScheme, error) { |
| 15 | auths := map[string]AuthScheme{} |
| 16 | for _, a := range cfg { |
| 17 | switch a.Type { |
| 18 | case "basic": |
| 19 | b, err := newBasicAuth(a.Basic) |
| 20 | if err != nil { |
| 21 | return nil, err |
| 22 | } |
| 23 | auths[a.Name] = b |
| 24 | default: |
| 25 | return nil, fmt.Errorf("unknown auth type '%s'", a.Type) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return auths, nil |
| 30 | } |