mirror of
https://github.com/openziti/zrok.git
synced 2024-11-28 19:14:07 +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 {
|
||||
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,
|
||||
|
@ -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,
|
||||
|
@ -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})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user