cmd/dex: make connector name field mandatory in dex configuration.

This commit is contained in:
rithu john 2017-01-23 15:14:41 -08:00
parent 613d160ad9
commit 31e8009441
4 changed files with 11 additions and 0 deletions

View File

@ -15,7 +15,9 @@ The following is an example of a configuration for `examples/config-dev.yaml`:
```yaml ```yaml
connectors: connectors:
- type: github - type: github
# Required field for connector id.
id: github id: github
# Required field for connector name.
name: GitHub name: GitHub
config: config:
# Credentials can be string literals or pulled from the environment. # Credentials can be string literals or pulled from the environment.

View File

@ -24,7 +24,9 @@ The following is an example config file that can be used by the LDAP connector t
```yaml ```yaml
connectors: connectors:
- type: ldap - type: ldap
# Required field for connector id.
id: ldap id: ldap
# Required field for connector name.
name: LDAP name: LDAP
config: config:
# Host and optional port of the LDAP server in the form "host:port". # Host and optional port of the LDAP server in the form "host:port".
@ -189,6 +191,7 @@ The following configuration will allow the LDAP connector to search a FreeIPA di
connectors: connectors:
- type: ldap - type: ldap
id: ldap id: ldap
name: LDAP
config: config:
# host and port of the LDAP server in form "host:port". # host and port of the LDAP server in form "host:port".
host: freeipa.example.com:636 host: freeipa.example.com:636

View File

@ -19,7 +19,10 @@ The connector doesn't support refresh tokens since the SAML 2.0 protocol doesn't
```yaml ```yaml
connectors: connectors:
- type: samlExperimental # will be changed to "saml" later without support for the "samlExperimental" value - type: samlExperimental # will be changed to "saml" later without support for the "samlExperimental" value
# Required field for connector id.
id: saml id: saml
# Required field for connector name.
name: SAML
config: config:
# Issuer used for validating the SAML response. # Issuer used for validating the SAML response.
issuer: https://saml.example.com issuer: https://saml.example.com

View File

@ -136,6 +136,9 @@ func serve(cmd *cobra.Command, args []string) error {
if conn.Config == nil { if conn.Config == nil {
return fmt.Errorf("invalid config: no config field for connector %q", conn.ID) return fmt.Errorf("invalid config: no config field for connector %q", conn.ID)
} }
if conn.Name == "" {
return fmt.Errorf("invalid config: no Name field for connector %q", conn.ID)
}
logger.Infof("config connector: %s", conn.ID) logger.Infof("config connector: %s", conn.ID)
connectorLogger := logger.WithField("connector", conn.Name) connectorLogger := logger.WithField("connector", conn.Name)