src/server/auth/server/api_server.go
func NewAuthServer(env *serviceenv.ServiceEnv, etcdPrefix string, public bool) (authclient.APIServer, error) {
	s := &apiServer{
		env:        env,
		pachLogger: log.NewLogger("authclient.API"),
		adminCache: make(map[string]struct{}),
		tokens: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, tokensPrefix),
			nil,
			&authclient.TokenInfo{},
			nil,
			nil,
		),
		authenticationCodes: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, authenticationCodesPrefix),
			nil,
			&authclient.OTPInfo{},
			nil,
			nil,
		),
		acls: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, aclsPrefix),
			nil,
			&authclient.ACL{},
			nil,
			nil,
		),
		admins: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, adminsPrefix),
			nil,
			&types.BoolValue{}, // smallest value that etcd actually stores
			nil,
			nil,
		),
		members: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, membersPrefix),
			nil,
			&authclient.Groups{},
			nil,
			nil,
		),
		groups: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, groupsPrefix),
			nil,
			&authclient.Users{},
			nil,
			nil,
		),
		authConfig: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, configKey),
			nil,
			&authclient.AuthConfig{},
			nil,
			nil,
		),
		public: public,
	}
	go s.retrieveOrGeneratePPSToken()
	go s.watchAdmins(path.Join(etcdPrefix, adminsPrefix))

	if public {
		// start SAML service (won't respond to
		// anything until config is set)
		go s.serveSAML()
	}
	// Watch for new auth config options
	go s.watchConfig()
	return s, nil
}
func NewAuthServer(env *serviceenv.ServiceEnv, etcdPrefix string, public bool) (authclient.APIServer, error) {
	s := &apiServer{
		env:        env,
		pachLogger: log.NewLogger("authclient.API"),
		adminCache: make(map[string]struct{}),
		tokens: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, tokensPrefix),
			nil,
			&authclient.TokenInfo{},
			nil,
			nil,
		),
		authenticationCodes: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, authenticationCodesPrefix),
			nil,
			&authclient.OTPInfo{},
			nil,
			nil,
		),
		acls: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, aclsPrefix),
			nil,
			&authclient.ACL{},
			nil,
			nil,
		),
		admins: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, adminsPrefix),
			nil,
			&types.BoolValue{}, // smallest value that etcd actually stores
			nil,
			nil,
		),
		members: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, membersPrefix),
			nil,
			&authclient.Groups{},
			nil,
			nil,
		),
		groups: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, groupsPrefix),
			nil,
			&authclient.Users{},
			nil,
			nil,
		),
		authConfig: col.NewCollection(
			env.GetEtcdClient(),
			path.Join(etcdPrefix, configKey),
			nil,
			&authclient.AuthConfig{},
			nil,
			nil,
		),
		public: public,
	}
	go s.retrieveOrGeneratePPSToken()
	go s.watchAdmins(path.Join(etcdPrefix, adminsPrefix))

	if public {
		// start SAML service (won't respond to
		// anything until config is set)
		go s.serveSAML()
	}
	// Watch for new auth config options
	go s.watchConfig()
	return s, nil
}
// NewAuthServer returns an implementation of authclient.APIServer.