refactor authentication (#1951)

* refactor authentication

* refactor authentication
This commit is contained in:
zryfish
2020-03-15 23:26:32 +08:00
committed by GitHub
parent eb8a3c0dc6
commit 0a07e5f652
11 changed files with 60 additions and 52 deletions

View File

@@ -143,9 +143,9 @@ func (s *APIServer) installKubeSphereAPIs() {
urlruntime.Must(servicemeshv1alpha2.AddToContainer(s.container))
}
func (s *APIServer) Run(stopCh <-chan struct{}) error {
func (s *APIServer) Run(stopCh <-chan struct{}) (err error) {
err := s.waitForResourceSync(stopCh)
err = s.waitForResourceSync(stopCh)
if err != nil {
return err
}
@@ -160,10 +160,12 @@ func (s *APIServer) Run(stopCh <-chan struct{}) error {
klog.V(0).Infof("Start listening on %s", s.Server.Addr)
if s.Server.TLSConfig != nil {
return s.Server.ListenAndServeTLS("", "")
err = s.Server.ListenAndServeTLS("", "")
} else {
return s.Server.ListenAndServe()
err = s.Server.ListenAndServe()
}
return err
}
func (s *APIServer) buildHandlerChain() {

View File

@@ -78,7 +78,7 @@ type Config struct {
// Options below are only loaded from configuration file, no command line flags for these options now.
KubeSphereOptions *kubesphere.Options `json:"-" yaml:"kubesphere,omitempty" mapstructure:"kubesphere"`
AuthenticateOptions *iam.AuthenticationOptions `json:"authenticate,omitempty" yaml:"authenticate,omitempty" mapstructure:"authenticate"`
AuthenticateOptions *iam.AuthenticationOptions `json:"authentication,omitempty" yaml:"authenticate,omitempty" mapstructure:"authenticate"`
// Options used for enabling components, not actually used now. Once we switch Alerting/Notification API to kubesphere,
// we can add these options to kubesphere command lines
@@ -194,7 +194,7 @@ func (conf *Config) stripEmptyOptions() {
conf.MySQLOptions = nil
}
if conf.RedisOptions != nil && conf.RedisOptions.RedisURL == "" {
if conf.RedisOptions != nil && conf.RedisOptions.Host == "" {
conf.RedisOptions = nil
}

View File

@@ -64,7 +64,10 @@ func newTestConfig() *Config {
GroupSearchBase: "ou=Groups,dc=example,dc=org",
},
RedisOptions: &cache.Options{
RedisURL: "redis://:qwerty@localhost:6379/1",
Host: "localhost:6379",
Port: 6379,
Password: "P@88w0rd",
DB: 0,
},
S3Options: &s3.Options{
Endpoint: "http://minio.openpitrix-system.svc",