15881: Move Google, SSO, and PAM configs into their own sections.
authorTom Clegg <tom@tomclegg.ca>
Fri, 8 May 2020 17:46:44 +0000 (13:46 -0400)
committerTom Clegg <tom@tomclegg.ca>
Fri, 8 May 2020 17:46:44 +0000 (13:46 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

13 files changed:
doc/install/setup-login.html.textile.liquid
lib/config/config.default.yml
lib/config/deprecated.go
lib/config/deprecated_test.go
lib/config/export.go
lib/config/generated_config.go
lib/controller/localdb/login.go
lib/controller/localdb/login_google.go
lib/controller/localdb/login_google_test.go
lib/controller/localdb/login_ldap_docker_test.sh
lib/controller/localdb/login_pam.go
lib/controller/localdb/login_pam_test.go
sdk/go/arvados/config.go

index 753ba82ba69e329b988fd0f824195c6e4aaa571c..a9fa4fd4e0d04732a6ba17254d540c7903b41b18 100644 (file)
@@ -22,12 +22,13 @@ With this configuration, users will sign in with their Google accounts.
 
 First, visit "Setting up Google auth.":google-auth.html
 
-Next, copy the values of *Client ID* and *Client secret* from the Google Developers Console into @Login.GoogleClientID@ and @Login.GoogleClientSecret@ of @config.yml@:
+Next, copy the values of *Client ID* and *Client secret* from the Google Developers Console into @Login.Google.ClientID@ and @Login.Google.ClientSecret@ in @config.yml@:
 
 <pre>
     Login:
-      GoogleClientID: "0000000000000-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.apps.googleusercontent.com"
-      GoogleClientSecret: "zzzzzzzzzzzzzzzzzzzzzzzz"
+      Google:
+        ClientID: "0000000000000-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.apps.googleusercontent.com"
+        ClientSecret: "zzzzzzzzzzzzzzzzzzzzzzzz"
 </pre>
 
 h2(#ldap). LDAP
@@ -64,7 +65,8 @@ Enable PAM authentication in @config.yml@:
 
 <pre>
     Login:
-      PAM: true
+      PAM:
+        Enable: true
 </pre>
 
 Check the "default config file":{{site.baseurl}}/admin/config.html for more PAM configuration options.
index 2aa58ac31e96657a5b6b075a428c1d7453610ec9..e248458899c902275b183a6ad254762ad33fbf52 100644 (file)
@@ -524,54 +524,55 @@ Clusters:
         MaxUUIDEntries:       1000
 
     Login:
-      # These settings are provided by your OAuth2 provider (eg
-      # Google) used to perform upstream authentication.
-      ProviderAppID: ""
-      ProviderAppSecret: ""
-
-      # (Experimental) Authenticate with Google, bypassing the
-      # SSO-provider gateway service. Use the Google Cloud console to
-      # enable the People API (APIs and Services > Enable APIs and
-      # services > Google People API > Enable), generate a Client ID
-      # and secret (APIs and Services > Credentials > Create
-      # credentials > OAuth client ID > Web application) and add your
-      # controller's /login URL (e.g.,
-      # "https://zzzzz.example.com/login") as an authorized redirect
-      # URL.
-      #
-      # Incompatible with ForceLegacyAPI14. ProviderAppID must be
-      # blank.
-      GoogleClientID: ""
-      GoogleClientSecret: ""
-
-      # Allow users to log in to existing accounts using any verified
-      # email address listed by their Google account. If true, the
-      # Google People API must be enabled in order for Google login to
-      # work. If false, only the primary email address will be used.
-      GoogleAlternateEmailAddresses: true
-
-      # (Experimental) Use PAM to authenticate logins, using the
-      # specified PAM service name.
-      #
-      # Cannot be used in combination with OAuth2 (ProviderAppID) or
-      # Google (GoogleClientID). Cannot be used on a cluster acting as
-      # a LoginCluster.
-      PAM: false
-      PAMService: arvados
-
-      # Domain name (e.g., "example.com") to use to construct the
-      # user's email address if PAM authentication returns a username
-      # with no "@". If empty, use the PAM username as the user's
-      # email address, whether or not it contains "@".
-      #
-      # Note that the email address is used as the primary key for
-      # user records when logging in. Therefore, if you change
-      # PAMDefaultEmailDomain after the initial installation, you
-      # should also update existing user records to reflect the new
-      # domain. Otherwise, next time those users log in, they will be
-      # given new accounts instead of accessing their existing
-      # accounts.
-      PAMDefaultEmailDomain: ""
+      # One of the following mechanisms (SSO, Google, PAM, LDAP, or
+      # LoginCluster) should be enabled; see
+      # https://doc.arvados.org/install/setup-login.html
+
+      Google:
+        # Authenticate with Google.
+        Enable: false
+
+        # Use the Google Cloud console to enable the People API (APIs
+        # and Services > Enable APIs and services > Google People API
+        # > Enable), generate a Client ID and secret (APIs and
+        # Services > Credentials > Create credentials > OAuth client
+        # ID > Web application) and add your controller's /login URL
+        # (e.g., "https://zzzzz.example.com/login") as an authorized
+        # redirect URL.
+        #
+        # Incompatible with ForceLegacyAPI14. ProviderAppID must be
+        # blank.
+        ClientID: ""
+        ClientSecret: ""
+
+        # Allow users to log in to existing accounts using any verified
+        # email address listed by their Google account. If true, the
+        # Google People API must be enabled in order for Google login to
+        # work. If false, only the primary email address will be used.
+        AlternateEmailAddresses: true
+
+      PAM:
+        # (Experimental) Use PAM to authenticate users.
+        Enable: false
+
+        # PAM service name. PAM will apply the policy in the
+        # corresponding config file (e.g., /etc/pam.d/arvados) or, if
+        # there is none, the default "other" config.
+        Service: arvados
+
+        # Domain name (e.g., "example.com") to use to construct the
+        # user's email address if PAM authentication returns a
+        # username with no "@". If empty, use the PAM username as the
+        # user's email address, whether or not it contains "@".
+        #
+        # Note that the email address is used as the primary key for
+        # user records when logging in. Therefore, if you change
+        # PAMDefaultEmailDomain after the initial installation, you
+        # should also update existing user records to reflect the new
+        # domain. Otherwise, next time those users log in, they will
+        # be given new accounts instead of accessing their existing
+        # accounts.
+        DefaultEmailDomain: ""
 
       LDAP:
         # Use an LDAP service to authenticate users.
@@ -631,6 +632,16 @@ Clusters:
         # originally supplied by the user will be used.
         UsernameAttribute: uid
 
+      SSO:
+        # Authenticate with a separate SSO server.
+        Enable: false
+
+        # ProviderAppID and ProviderAppSecret are generated during SSO
+        # setup; see
+        # https://doc.arvados.org/install/install-sso.html#update-config
+        ProviderAppID: ""
+        ProviderAppSecret: ""
+
       # The cluster ID to delegate the user database.  When set,
       # logins on this cluster will be redirected to the login cluster
       # (login cluster must appear in RemoteClusters with Proxy: true)
index 0689efa440f5f611696680e64c631dc1be3b6a3f..3d62e7cc56e317f778674ef4558fa234aa6291a3 100644 (file)
@@ -23,6 +23,13 @@ type deprRequestLimits struct {
 type deprCluster struct {
        RequestLimits deprRequestLimits
        NodeProfiles  map[string]nodeProfile
+       Login         struct {
+               GoogleClientID                *string
+               GoogleClientSecret            *string
+               GoogleAlternateEmailAddresses *bool
+               ProviderAppID                 *string
+               ProviderAppSecret             *string
+       }
 }
 
 type deprecatedConfig struct {
@@ -80,6 +87,34 @@ func (ldr *Loader) applyDeprecatedConfig(cfg *arvados.Config) error {
                if dst, n := &cluster.API.MaxRequestAmplification, dcluster.RequestLimits.MultiClusterRequestConcurrency; n != nil && *n != *dst {
                        *dst = *n
                }
+
+               // Google* moved to Google.*
+               if dst, n := &cluster.Login.Google.ClientID, dcluster.Login.GoogleClientID; n != nil && *n != *dst {
+                       *dst = *n
+                       if *n != "" {
+                               // In old config, non-empty ClientID meant enable
+                               cluster.Login.Google.Enable = true
+                       }
+               }
+               if dst, n := &cluster.Login.Google.ClientSecret, dcluster.Login.GoogleClientSecret; n != nil && *n != *dst {
+                       *dst = *n
+               }
+               if dst, n := &cluster.Login.Google.AlternateEmailAddresses, dcluster.Login.GoogleAlternateEmailAddresses; n != nil && *n != *dst {
+                       *dst = *n
+               }
+
+               // Provider* moved to SSO.Provider*
+               if dst, n := &cluster.Login.SSO.ProviderAppID, dcluster.Login.ProviderAppID; n != nil && *n != *dst {
+                       *dst = *n
+                       if *n != "" {
+                               // In old config, non-empty ID meant enable
+                               cluster.Login.SSO.Enable = true
+                       }
+               }
+               if dst, n := &cluster.Login.SSO.ProviderAppSecret, dcluster.Login.ProviderAppSecret; n != nil && *n != *dst {
+                       *dst = *n
+               }
+
                cfg.Clusters[id] = cluster
        }
        return nil
index 58c27e984ad4b6ce17176a15f43c6a69ac9df0ee..96eea4264cd1b288bee83c057ea9fa5e0f6f52b5 100644 (file)
@@ -89,6 +89,41 @@ Clusters:
 `)
 }
 
+func (s *LoadSuite) TestDeprecatedLoginBackend(c *check.C) {
+       checkEquivalent(c, `
+Clusters:
+ z1111:
+  Login:
+   GoogleClientID: aaaa
+   GoogleClientSecret: bbbb
+   GoogleAlternateEmailAddresses: true
+`, `
+Clusters:
+ z1111:
+  Login:
+   Google:
+    Enable: true
+    ClientID: aaaa
+    ClientSecret: bbbb
+    AlternateEmailAddresses: true
+`)
+       checkEquivalent(c, `
+Clusters:
+ z1111:
+  Login:
+   ProviderAppID: aaaa
+   ProviderAppSecret: bbbb
+`, `
+Clusters:
+ z1111:
+  Login:
+   SSO:
+    Enable: true
+    ProviderAppID: aaaa
+    ProviderAppSecret: bbbb
+`)
+}
+
 func (s *LoadSuite) TestLegacyKeepWebConfig(c *check.C) {
        content := []byte(`
 {
index 323043fbe7b6f7cf0d4ab92ec228f081415e37eb..26782c8ba61dca3e4b657b911b6361439522ebb6 100644 (file)
@@ -131,14 +131,11 @@ var whitelist = map[string]bool{
        "InstanceTypes.*":                              true,
        "InstanceTypes.*.*":                            true,
        "Login":                                        true,
-       "Login.GoogleClientID":                         false,
-       "Login.GoogleClientSecret":                     false,
-       "Login.GoogleAlternateEmailAddresses":          false,
-       "Login.PAM":                                    true,
-       "Login.PAMService":                             false,
-       "Login.PAMDefaultEmailDomain":                  false,
-       "Login.ProviderAppID":                          false,
-       "Login.ProviderAppSecret":                      false,
+       "Login.Google":                                 true,
+       "Login.Google.AlternateEmailAddresses":         false,
+       "Login.Google.ClientID":                        false,
+       "Login.Google.ClientSecret":                    false,
+       "Login.Google.Enable":                          true,
        "Login.LDAP":                                   true,
        "Login.LDAP.AppendDomain":                      false,
        "Login.LDAP.EmailAttribute":                    false,
@@ -146,14 +143,22 @@ var whitelist = map[string]bool{
        "Login.LDAP.InsecureTLS":                       false,
        "Login.LDAP.SearchAttribute":                   false,
        "Login.LDAP.SearchBase":                        false,
-       "Login.LDAP.SearchBindUser":                    false,
        "Login.LDAP.SearchBindPassword":                false,
+       "Login.LDAP.SearchBindUser":                    false,
        "Login.LDAP.SearchFilters":                     false,
        "Login.LDAP.StartTLS":                          false,
        "Login.LDAP.StripDomain":                       false,
        "Login.LDAP.URL":                               false,
        "Login.LDAP.UsernameAttribute":                 false,
        "Login.LoginCluster":                           true,
+       "Login.PAM":                                    true,
+       "Login.PAM.DefaultEmailDomain":                 false,
+       "Login.PAM.Enable":                             true,
+       "Login.PAM.Service":                            false,
+       "Login.SSO":                                    true,
+       "Login.SSO.Enable":                             true,
+       "Login.SSO.ProviderAppID":                      false,
+       "Login.SSO.ProviderAppSecret":                  false,
        "Login.RemoteTokenRefresh":                     true,
        "Mail":                                         true,
        "Mail.MailchimpAPIKey":                         false,
index 4677fe544430dc07b4f3f8c9373cc769d93ebb62..df08dd00e2a429ac14005dd4f849c3e1ec6992bf 100644 (file)
@@ -530,54 +530,55 @@ Clusters:
         MaxUUIDEntries:       1000
 
     Login:
-      # These settings are provided by your OAuth2 provider (eg
-      # Google) used to perform upstream authentication.
-      ProviderAppID: ""
-      ProviderAppSecret: ""
-
-      # (Experimental) Authenticate with Google, bypassing the
-      # SSO-provider gateway service. Use the Google Cloud console to
-      # enable the People API (APIs and Services > Enable APIs and
-      # services > Google People API > Enable), generate a Client ID
-      # and secret (APIs and Services > Credentials > Create
-      # credentials > OAuth client ID > Web application) and add your
-      # controller's /login URL (e.g.,
-      # "https://zzzzz.example.com/login") as an authorized redirect
-      # URL.
-      #
-      # Incompatible with ForceLegacyAPI14. ProviderAppID must be
-      # blank.
-      GoogleClientID: ""
-      GoogleClientSecret: ""
-
-      # Allow users to log in to existing accounts using any verified
-      # email address listed by their Google account. If true, the
-      # Google People API must be enabled in order for Google login to
-      # work. If false, only the primary email address will be used.
-      GoogleAlternateEmailAddresses: true
-
-      # (Experimental) Use PAM to authenticate logins, using the
-      # specified PAM service name.
-      #
-      # Cannot be used in combination with OAuth2 (ProviderAppID) or
-      # Google (GoogleClientID). Cannot be used on a cluster acting as
-      # a LoginCluster.
-      PAM: false
-      PAMService: arvados
-
-      # Domain name (e.g., "example.com") to use to construct the
-      # user's email address if PAM authentication returns a username
-      # with no "@". If empty, use the PAM username as the user's
-      # email address, whether or not it contains "@".
-      #
-      # Note that the email address is used as the primary key for
-      # user records when logging in. Therefore, if you change
-      # PAMDefaultEmailDomain after the initial installation, you
-      # should also update existing user records to reflect the new
-      # domain. Otherwise, next time those users log in, they will be
-      # given new accounts instead of accessing their existing
-      # accounts.
-      PAMDefaultEmailDomain: ""
+      # One of the following mechanisms (SSO, Google, PAM, LDAP, or
+      # LoginCluster) should be enabled; see
+      # https://doc.arvados.org/install/setup-login.html
+
+      Google:
+        # Authenticate with Google.
+        Enable: false
+
+        # Use the Google Cloud console to enable the People API (APIs
+        # and Services > Enable APIs and services > Google People API
+        # > Enable), generate a Client ID and secret (APIs and
+        # Services > Credentials > Create credentials > OAuth client
+        # ID > Web application) and add your controller's /login URL
+        # (e.g., "https://zzzzz.example.com/login") as an authorized
+        # redirect URL.
+        #
+        # Incompatible with ForceLegacyAPI14. ProviderAppID must be
+        # blank.
+        ClientID: ""
+        ClientSecret: ""
+
+        # Allow users to log in to existing accounts using any verified
+        # email address listed by their Google account. If true, the
+        # Google People API must be enabled in order for Google login to
+        # work. If false, only the primary email address will be used.
+        AlternateEmailAddresses: true
+
+      PAM:
+        # (Experimental) Use PAM to authenticate users.
+        Enable: false
+
+        # PAM service name. PAM will apply the policy in the
+        # corresponding config file (e.g., /etc/pam.d/arvados) or, if
+        # there is none, the default "other" config.
+        Service: arvados
+
+        # Domain name (e.g., "example.com") to use to construct the
+        # user's email address if PAM authentication returns a
+        # username with no "@". If empty, use the PAM username as the
+        # user's email address, whether or not it contains "@".
+        #
+        # Note that the email address is used as the primary key for
+        # user records when logging in. Therefore, if you change
+        # PAMDefaultEmailDomain after the initial installation, you
+        # should also update existing user records to reflect the new
+        # domain. Otherwise, next time those users log in, they will
+        # be given new accounts instead of accessing their existing
+        # accounts.
+        DefaultEmailDomain: ""
 
       LDAP:
         # Use an LDAP service to authenticate users.
@@ -637,6 +638,16 @@ Clusters:
         # originally supplied by the user will be used.
         UsernameAttribute: uid
 
+      SSO:
+        # Authenticate with a separate SSO server.
+        Enable: false
+
+        # ProviderAppID and ProviderAppSecret are generated during SSO
+        # setup; see
+        # https://doc.arvados.org/install/install-sso.html#update-config
+        ProviderAppID: ""
+        ProviderAppSecret: ""
+
       # The cluster ID to delegate the user database.  When set,
       # logins on this cluster will be redirected to the login cluster
       # (login cluster must appear in RemoteClusters with Proxy: true)
index 8cba3b6fa1a1dabafdfecc52f510238cc44f5eeb..0fd0a9ad2348045c1abd85b3f47a54a5d25dc202 100644 (file)
@@ -23,9 +23,9 @@ type loginController interface {
 }
 
 func chooseLoginController(cluster *arvados.Cluster, railsProxy *railsProxy) loginController {
-       wantGoogle := cluster.Login.GoogleClientID != ""
-       wantSSO := cluster.Login.ProviderAppID != ""
-       wantPAM := cluster.Login.PAM
+       wantGoogle := cluster.Login.Google.Enable
+       wantSSO := cluster.Login.SSO.Enable
+       wantPAM := cluster.Login.PAM.Enable
        wantLDAP := cluster.Login.LDAP.Enable
        switch {
        case wantGoogle && !wantSSO && !wantPAM && !wantLDAP:
@@ -38,7 +38,7 @@ func chooseLoginController(cluster *arvados.Cluster, railsProxy *railsProxy) log
                return &ldapLoginController{Cluster: cluster, RailsProxy: railsProxy}
        default:
                return errorLoginController{
-                       error: errors.New("configuration problem: exactly one of Login.GoogleClientID, Login.ProviderAppID, Login.PAM, or Login.LDAP.Enable must be configured"),
+                       error: errors.New("configuration problem: exactly one of Login.Google, Login.SSO, Login.PAM, and Login.LDAP must be enabled"),
                }
        }
 }
index bf1754c158968e40c6cb7d32a31d55ab4c83fcde..144b04c46d7ee6ab865eff24a7acc06db08f5dd9 100644 (file)
@@ -71,8 +71,8 @@ func (ctrl *googleLoginController) Login(ctx context.Context, opts arvados.Login
                return loginError(fmt.Errorf("error making redirect URL: %s", err))
        }
        conf := &oauth2.Config{
-               ClientID:     ctrl.Cluster.Login.GoogleClientID,
-               ClientSecret: ctrl.Cluster.Login.GoogleClientSecret,
+               ClientID:     ctrl.Cluster.Login.Google.ClientID,
+               ClientSecret: ctrl.Cluster.Login.Google.ClientSecret,
                Endpoint:     provider.Endpoint(),
                Scopes:       []string{oidc.ScopeOpenID, "profile", "email"},
                RedirectURL:  redirURL.String(),
@@ -162,7 +162,7 @@ func (ctrl *googleLoginController) getAuthInfo(ctx context.Context, cluster *arv
                ret.Email = claims.Email
        }
 
-       if !ctrl.Cluster.Login.GoogleAlternateEmailAddresses {
+       if !ctrl.Cluster.Login.Google.AlternateEmailAddresses {
                if ret.Email == "" {
                        return nil, fmt.Errorf("cannot log in with unverified email address %q", claims.Email)
                }
index 9e16e2e90439a8ab7767930b6c701fe6d6ab604a..495fbb69b31e5c659b4476c772303658e46592c1 100644 (file)
@@ -146,10 +146,10 @@ func (s *LoginSuite) SetUpTest(c *check.C) {
 
        cfg, err := config.NewLoader(nil, ctxlog.TestLogger(c)).Load()
        s.cluster, err = cfg.GetCluster("")
-       s.cluster.Login.ProviderAppID = ""
-       s.cluster.Login.ProviderAppSecret = ""
-       s.cluster.Login.GoogleClientID = "test%client$id"
-       s.cluster.Login.GoogleClientSecret = "test#client/secret"
+       s.cluster.Login.SSO.Enable = false
+       s.cluster.Login.Google.Enable = true
+       s.cluster.Login.Google.ClientID = "test%client$id"
+       s.cluster.Login.Google.ClientSecret = "test#client/secret"
        s.cluster.Users.PreferDomainForUsername = "PreferDomainForUsername.example.com"
        c.Assert(err, check.IsNil)
 
@@ -227,7 +227,7 @@ func (s *LoginSuite) setupPeopleAPIError(c *check.C) {
 }
 
 func (s *LoginSuite) TestGoogleLogin_PeopleAPIDisabled(c *check.C) {
-       s.cluster.Login.GoogleAlternateEmailAddresses = false
+       s.cluster.Login.Google.AlternateEmailAddresses = false
        s.authEmail = "joe.smith@primary.example.com"
        s.setupPeopleAPIError(c)
        state := s.startLogin(c)
index 61b1e0e8845589c8c161db6c1ccdbcc0d874d7e3..4e0679f620bf6b4ec67d8fc118b66db5ef3332ac 100755 (executable)
@@ -103,11 +103,12 @@ case "${config_method}" in
         setup_pam_ldap="apt update && DEBIAN_FRONTEND=noninteractive apt install -y ldap-utils libpam-ldap && pam-auth-update --package /usr/share/pam-configs/ldap"
         cat >>"${tmpdir}/zzzzz.yml" <<EOF
     Login:
-      PAM: true
-      # Without this magic PAMDefaultEmailDomain, inserted users would
-      # prevent subsequent database/reset from working (see
-      # database_controller.rb).
-      PAMDefaultEmailDomain: example.com
+      PAM:
+        Enable: true
+        # Without this specific DefaultEmailDomain, inserted users
+        # would prevent subsequent database/reset from working (see
+        # database_controller.rb).
+        DefaultEmailDomain: example.com
 EOF
         ;;
     ldap)
index 538e3118edc839e0be355a6965de6da086b9ce9d..2447713a2cf453ea05cfc29e2c643fa0713848a9 100644 (file)
@@ -35,7 +35,7 @@ func (ctrl *pamLoginController) Login(ctx context.Context, opts arvados.LoginOpt
 func (ctrl *pamLoginController) UserAuthenticate(ctx context.Context, opts arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
        errorMessage := ""
        sentPassword := false
-       tx, err := pam.StartFunc(ctrl.Cluster.Login.PAMService, opts.Username, func(style pam.Style, message string) (string, error) {
+       tx, err := pam.StartFunc(ctrl.Cluster.Login.PAM.Service, opts.Username, func(style pam.Style, message string) (string, error) {
                ctxlog.FromContext(ctx).Debugf("pam conversation: style=%v message=%q", style, message)
                switch style {
                case pam.ErrorMsg:
@@ -80,7 +80,7 @@ func (ctrl *pamLoginController) UserAuthenticate(ctx context.Context, opts arvad
                return arvados.APIClientAuthorization{}, err
        }
        email := user
-       if domain := ctrl.Cluster.Login.PAMDefaultEmailDomain; domain != "" && !strings.Contains(email, "@") {
+       if domain := ctrl.Cluster.Login.PAM.DefaultEmailDomain; domain != "" && !strings.Contains(email, "@") {
                email = email + "@" + domain
        }
        ctxlog.FromContext(ctx).WithFields(logrus.Fields{
index 5b0e4533e1844c543539ebab7567e8ca2973d82c..e6b967c9440b887cc6b2e68bd3ccb5e7a8fa78eb 100644 (file)
@@ -32,8 +32,8 @@ func (s *PamSuite) SetUpSuite(c *check.C) {
        c.Assert(err, check.IsNil)
        s.cluster, err = cfg.GetCluster("")
        c.Assert(err, check.IsNil)
-       s.cluster.Login.PAM = true
-       s.cluster.Login.PAMDefaultEmailDomain = "example.com"
+       s.cluster.Login.PAM.Enable = true
+       s.cluster.Login.PAM.DefaultEmailDomain = "example.com"
        s.railsSpy = arvadostest.NewProxy(c, s.cluster.Services.RailsAPI)
        s.ctrl = &pamLoginController{
                Cluster:    s.cluster,
@@ -79,6 +79,6 @@ func (s *PamSuite) TestLoginSuccess(c *check.C) {
        c.Check(resp.Scopes, check.DeepEquals, []string{"all"})
 
        authinfo := getCallbackAuthInfo(c, s.railsSpy)
-       c.Check(authinfo.Email, check.Equals, u+"@"+s.cluster.Login.PAMDefaultEmailDomain)
+       c.Check(authinfo.Email, check.Equals, u+"@"+s.cluster.Login.PAM.DefaultEmailDomain)
        c.Check(authinfo.AlternateEmails, check.DeepEquals, []string(nil))
 }
index 817f5b7a69971e0049f88edc59687d075cc7af37..7ab8d9e1f64e0260125a010be633062cb4305fa9 100644 (file)
@@ -150,16 +150,24 @@ type Cluster struct {
                        EmailAttribute     string
                        UsernameAttribute  string
                }
-               GoogleClientID                string
-               GoogleClientSecret            string
-               GoogleAlternateEmailAddresses bool
-               PAM                           bool
-               PAMService                    string
-               PAMDefaultEmailDomain         string
-               ProviderAppID                 string
-               ProviderAppSecret             string
-               LoginCluster                  string
-               RemoteTokenRefresh            Duration
+               Google struct {
+                       Enable                  bool
+                       ClientID                string
+                       ClientSecret            string
+                       AlternateEmailAddresses bool
+               }
+               PAM struct {
+                       Enable             bool
+                       Service            string
+                       DefaultEmailDomain string
+               }
+               SSO struct {
+                       Enable            bool
+                       ProviderAppID     string
+                       ProviderAppSecret string
+               }
+               LoginCluster       string
+               RemoteTokenRefresh Duration
        }
        Mail struct {
                MailchimpAPIKey                string