diff --git a/controller/sharePrivate.go b/controller/sharePrivate.go index a40dd9a8..7a06a797 100644 --- a/controller/sharePrivate.go +++ b/controller/sharePrivate.go @@ -18,9 +18,13 @@ func (a *privateResourceAllocator) allocate(envZId, shrToken string, params shar for _, authUser := range params.Body.AuthUsers { authUsers = append(authUsers, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password}) } + authScheme, err := sdk.ParseAuthScheme(params.Body.AuthScheme) + if err != nil { + return "", nil, err + } options := &zrokEdgeSdk.FrontendOptions{ - AuthScheme: params.Body.AuthScheme, - AuthUsers: authUsers, + AuthScheme: authScheme, + BasicAuthUsers: authUsers, Oauth: &sdk.OauthConfig{ Provider: params.Body.OauthProvider, EmailDomains: params.Body.OauthEmailDomains, diff --git a/controller/sharePublic.go b/controller/sharePublic.go index 6a585410..93a73ac8 100644 --- a/controller/sharePublic.go +++ b/controller/sharePublic.go @@ -18,9 +18,13 @@ func (a *publicResourceAllocator) allocate(envZId, shrToken string, frontendZIds for _, authUser := range params.Body.AuthUsers { authUsers = append(authUsers, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password}) } + authScheme, err := sdk.ParseAuthScheme(params.Body.AuthScheme) + if err != nil { + return "", nil, err + } options := &zrokEdgeSdk.FrontendOptions{ - AuthScheme: params.Body.AuthScheme, - AuthUsers: authUsers, + AuthScheme: authScheme, + BasicAuthUsers: authUsers, Oauth: &sdk.OauthConfig{ Provider: params.Body.OauthProvider, EmailDomains: params.Body.OauthEmailDomains, diff --git a/controller/zrokEdgeSdk/config.go b/controller/zrokEdgeSdk/config.go index 10590a44..8c31aeb8 100644 --- a/controller/zrokEdgeSdk/config.go +++ b/controller/zrokEdgeSdk/config.go @@ -12,22 +12,18 @@ import ( ) type FrontendOptions struct { - AuthScheme string - AuthUsers []*sdk.AuthUserConfig - Oauth *sdk.OauthConfig + AuthScheme sdk.AuthScheme + BasicAuthUsers []*sdk.AuthUserConfig + Oauth *sdk.OauthConfig } func CreateConfig(cfgTypeZId, envZId, shrToken string, options *FrontendOptions, edge *rest_management_api_client.ZitiEdgeManagement) (cfgZId string, err error) { - authScheme, err := sdk.ParseAuthScheme(options.AuthScheme) - if err != nil { - return "", err - } cfg := &sdk.FrontendConfig{ - AuthScheme: authScheme, + AuthScheme: options.AuthScheme, } if cfg.AuthScheme == sdk.Basic { cfg.BasicAuth = &sdk.BasicAuthConfig{} - for _, authUser := range options.AuthUsers { + for _, authUser := range options.BasicAuthUsers { cfg.BasicAuth.Users = append(cfg.BasicAuth.Users, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password}) } }