Move struct DynamicOptions to package pkg/server (#5625)

* move struct DynamicOptions to package pkg/server/dynamic_options.go

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

* update test types

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

---------

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>
This commit is contained in:
Wenhao Zhou
2023-04-07 11:33:36 +08:00
committed by GitHub
parent c57a89af3c
commit 62427cda32
21 changed files with 139 additions and 122 deletions

View File

@@ -22,6 +22,8 @@ import (
"net/http"
"testing"
"kubesphere.io/kubesphere/pkg/server/options"
"kubesphere.io/kubesphere/pkg/apiserver/authentication/oauth"
)
@@ -55,7 +57,7 @@ func (e emptyOAuthProvider) IdentityExchangeCallback(req *http.Request) (Identit
return emptyIdentity{}, nil
}
func (e emptyOAuthProviderFactory) Create(options oauth.DynamicOptions) (OAuthProvider, error) {
func (e emptyOAuthProviderFactory) Create(options options.DynamicOptions) (OAuthProvider, error) {
return emptyOAuthProvider{}, nil
}
@@ -74,7 +76,7 @@ func (e emptyGenericProvider) Authenticate(username string, password string) (Id
return emptyIdentity{}, nil
}
func (e emptyGenericProviderFactory) Create(options oauth.DynamicOptions) (GenericProvider, error) {
func (e emptyGenericProviderFactory) Create(options options.DynamicOptions) (GenericProvider, error) {
return emptyGenericProvider{}, nil
}
@@ -97,7 +99,7 @@ func TestSetupWith(t *testing.T) {
Name: "ldap",
MappingMethod: "auto",
Type: "LDAPIdentityProvider",
Provider: oauth.DynamicOptions{},
Provider: options.DynamicOptions{},
},
}},
wantErr: false,
@@ -109,7 +111,7 @@ func TestSetupWith(t *testing.T) {
Name: "ldap",
MappingMethod: "auto",
Type: "LDAPIdentityProvider",
Provider: oauth.DynamicOptions{},
Provider: options.DynamicOptions{},
},
}},
wantErr: true,
@@ -121,7 +123,7 @@ func TestSetupWith(t *testing.T) {
Name: "test",
MappingMethod: "auto",
Type: "NotSupported",
Provider: oauth.DynamicOptions{},
Provider: options.DynamicOptions{},
},
}},
wantErr: true,