mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
wire skip interstitial into public share config (#704)
This commit is contained in:
parent
275666c2b2
commit
d593232cf6
@ -133,7 +133,12 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr
|
||||
logrus.Infof("added frontend selection '%v' with ziti identity '%v' for share '%v'", frontendSelection, sfe.ZId, shrToken)
|
||||
}
|
||||
}
|
||||
shrZId, frontendEndpoints, err = newPublicResourceAllocator().allocate(envZId, shrToken, frontendZIds, frontendTemplates, params, edge)
|
||||
skipInterstitial, err := str.IsAccountGrantedSkipInterstitial(int(principal.ID), trx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error checking skip interstitial for account '%v': %v", principal.Email, err)
|
||||
return share.NewShareInternalServerError()
|
||||
}
|
||||
shrZId, frontendEndpoints, err = newPublicResourceAllocator().allocate(envZId, shrToken, frontendZIds, frontendTemplates, params, !skipInterstitial, edge)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return share.NewShareInternalServerError()
|
||||
|
@ -13,7 +13,7 @@ func newPublicResourceAllocator() *publicResourceAllocator {
|
||||
return &publicResourceAllocator{}
|
||||
}
|
||||
|
||||
func (a *publicResourceAllocator) allocate(envZId, shrToken string, frontendZIds, frontendTemplates []string, params share.ShareParams, edge *rest_management_api_client.ZitiEdgeManagement) (shrZId string, frontendEndpoints []string, err error) {
|
||||
func (a *publicResourceAllocator) allocate(envZId, shrToken string, frontendZIds, frontendTemplates []string, params share.ShareParams, interstitial bool, edge *rest_management_api_client.ZitiEdgeManagement) (shrZId string, frontendEndpoints []string, err error) {
|
||||
var authUsers []*sdk.AuthUserConfig
|
||||
for _, authUser := range params.Body.AuthUsers {
|
||||
authUsers = append(authUsers, &sdk.AuthUserConfig{Username: authUser.Username, Password: authUser.Password})
|
||||
@ -23,6 +23,7 @@ func (a *publicResourceAllocator) allocate(envZId, shrToken string, frontendZIds
|
||||
return "", nil, err
|
||||
}
|
||||
options := &zrokEdgeSdk.FrontendOptions{
|
||||
Interstitial: interstitial,
|
||||
AuthScheme: authScheme,
|
||||
BasicAuthUsers: authUsers,
|
||||
Oauth: &sdk.OauthConfig{
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
type FrontendOptions struct {
|
||||
Interstitial bool
|
||||
AuthScheme sdk.AuthScheme
|
||||
BasicAuthUsers []*sdk.AuthUserConfig
|
||||
Oauth *sdk.OauthConfig
|
||||
@ -19,7 +20,8 @@ type FrontendOptions struct {
|
||||
|
||||
func CreateConfig(cfgTypeZId, envZId, shrToken string, options *FrontendOptions, edge *rest_management_api_client.ZitiEdgeManagement) (cfgZId string, err error) {
|
||||
cfg := &sdk.FrontendConfig{
|
||||
AuthScheme: options.AuthScheme,
|
||||
Interstitial: options.Interstitial,
|
||||
AuthScheme: options.AuthScheme,
|
||||
}
|
||||
if cfg.AuthScheme == sdk.Basic {
|
||||
cfg.BasicAuth = &sdk.BasicAuthConfig{}
|
||||
|
Loading…
Reference in New Issue
Block a user