|
|
|
|
@ -3,8 +3,6 @@ package connector
|
|
|
|
|
import ( |
|
|
|
|
"encoding/json" |
|
|
|
|
"io" |
|
|
|
|
|
|
|
|
|
"github.com/coreos/dex/repo" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func ReadConfigs(r io.Reader) ([]ConnectorConfig, error) { |
|
|
|
|
@ -22,24 +20,3 @@ func ReadConfigs(r io.Reader) ([]ConnectorConfig, error) {
|
|
|
|
|
} |
|
|
|
|
return cfgs, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type memConnectorConfigRepo struct { |
|
|
|
|
configs []ConnectorConfig |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func NewConnectorConfigRepoFromConfigs(cfgs []ConnectorConfig) ConnectorConfigRepo { |
|
|
|
|
return &memConnectorConfigRepo{configs: cfgs} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (r *memConnectorConfigRepo) All() ([]ConnectorConfig, error) { |
|
|
|
|
return r.configs, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (r *memConnectorConfigRepo) GetConnectorByID(_ repo.Transaction, id string) (ConnectorConfig, error) { |
|
|
|
|
for _, cfg := range r.configs { |
|
|
|
|
if cfg.ConnectorID() == id { |
|
|
|
|
return cfg, nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nil, ErrorNotFound |
|
|
|
|
} |
|
|
|
|
|