mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 09:33:43 +01:00
frontend config polish (#404)
This commit is contained in:
parent
ed96a465a0
commit
22807406d6
@ -18,9 +18,13 @@ func (a *privateResourceAllocator) allocate(envZId, shrToken string, params shar
|
|||||||
for _, authUser := range params.Body.AuthUsers {
|
for _, authUser := range params.Body.AuthUsers {
|
||||||
authUsers = append(authUsers, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password})
|
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{
|
options := &zrokEdgeSdk.FrontendOptions{
|
||||||
AuthScheme: params.Body.AuthScheme,
|
AuthScheme: authScheme,
|
||||||
AuthUsers: authUsers,
|
BasicAuthUsers: authUsers,
|
||||||
Oauth: &sdk.OauthConfig{
|
Oauth: &sdk.OauthConfig{
|
||||||
Provider: params.Body.OauthProvider,
|
Provider: params.Body.OauthProvider,
|
||||||
EmailDomains: params.Body.OauthEmailDomains,
|
EmailDomains: params.Body.OauthEmailDomains,
|
||||||
|
@ -18,9 +18,13 @@ func (a *publicResourceAllocator) allocate(envZId, shrToken string, frontendZIds
|
|||||||
for _, authUser := range params.Body.AuthUsers {
|
for _, authUser := range params.Body.AuthUsers {
|
||||||
authUsers = append(authUsers, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password})
|
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{
|
options := &zrokEdgeSdk.FrontendOptions{
|
||||||
AuthScheme: params.Body.AuthScheme,
|
AuthScheme: authScheme,
|
||||||
AuthUsers: authUsers,
|
BasicAuthUsers: authUsers,
|
||||||
Oauth: &sdk.OauthConfig{
|
Oauth: &sdk.OauthConfig{
|
||||||
Provider: params.Body.OauthProvider,
|
Provider: params.Body.OauthProvider,
|
||||||
EmailDomains: params.Body.OauthEmailDomains,
|
EmailDomains: params.Body.OauthEmailDomains,
|
||||||
|
@ -12,22 +12,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type FrontendOptions struct {
|
type FrontendOptions struct {
|
||||||
AuthScheme string
|
AuthScheme sdk.AuthScheme
|
||||||
AuthUsers []*sdk.AuthUserConfig
|
BasicAuthUsers []*sdk.AuthUserConfig
|
||||||
Oauth *sdk.OauthConfig
|
Oauth *sdk.OauthConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateConfig(cfgTypeZId, envZId, shrToken string, options *FrontendOptions, edge *rest_management_api_client.ZitiEdgeManagement) (cfgZId string, err error) {
|
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{
|
cfg := &sdk.FrontendConfig{
|
||||||
AuthScheme: authScheme,
|
AuthScheme: options.AuthScheme,
|
||||||
}
|
}
|
||||||
if cfg.AuthScheme == sdk.Basic {
|
if cfg.AuthScheme == sdk.Basic {
|
||||||
cfg.BasicAuth = &sdk.BasicAuthConfig{}
|
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})
|
cfg.BasicAuth.Users = append(cfg.BasicAuth.Users, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user