From 31e8009441990d4ce8a81e1ba28913d7c0c1659b Mon Sep 17 00:00:00 2001 From: rithu john Date: Mon, 23 Jan 2017 15:14:41 -0800 Subject: [PATCH] cmd/dex: make connector name field mandatory in dex configuration. --- Documentation/github-connector.md | 2 ++ Documentation/ldap-connector.md | 3 +++ Documentation/saml-connector.md | 3 +++ cmd/dex/serve.go | 3 +++ 4 files changed, 11 insertions(+) diff --git a/Documentation/github-connector.md b/Documentation/github-connector.md index 6491c78e..223853bf 100644 --- a/Documentation/github-connector.md +++ b/Documentation/github-connector.md @@ -15,7 +15,9 @@ The following is an example of a configuration for `examples/config-dev.yaml`: ```yaml connectors: - type: github + # Required field for connector id. id: github + # Required field for connector name. name: GitHub config: # Credentials can be string literals or pulled from the environment. diff --git a/Documentation/ldap-connector.md b/Documentation/ldap-connector.md index a090140a..9dd3e447 100644 --- a/Documentation/ldap-connector.md +++ b/Documentation/ldap-connector.md @@ -24,7 +24,9 @@ The following is an example config file that can be used by the LDAP connector t ```yaml connectors: - type: ldap + # Required field for connector id. id: ldap + # Required field for connector name. name: LDAP config: # 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: - type: ldap id: ldap + name: LDAP config: # host and port of the LDAP server in form "host:port". host: freeipa.example.com:636 diff --git a/Documentation/saml-connector.md b/Documentation/saml-connector.md index d78a6f2b..28800463 100644 --- a/Documentation/saml-connector.md +++ b/Documentation/saml-connector.md @@ -19,7 +19,10 @@ The connector doesn't support refresh tokens since the SAML 2.0 protocol doesn't ```yaml connectors: - type: samlExperimental # will be changed to "saml" later without support for the "samlExperimental" value + # Required field for connector id. id: saml + # Required field for connector name. + name: SAML config: # Issuer used for validating the SAML response. issuer: https://saml.example.com diff --git a/cmd/dex/serve.go b/cmd/dex/serve.go index f08e65ee..6c708c4e 100644 --- a/cmd/dex/serve.go +++ b/cmd/dex/serve.go @@ -136,6 +136,9 @@ func serve(cmd *cobra.Command, args []string) error { if conn.Config == nil { 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) connectorLogger := logger.WithField("connector", conn.Name)