-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #2591 ziti edge login will not fail with split APIs
- ziti edge login now properly probes endpoints and their return content type along with the existing status code check - probed endpoint responses are no longer blindly parsed - the management endpoint is the default initial probe point, falling back to the client version endpoint then the legacy root version endpoint - the SPA/ZAC bindings for web apis has been moved to the webapis folder - improved erroring and messaging for the SPA/ZAC handling
- Loading branch information
1 parent
1932a6d
commit 5e0237e
Showing
8 changed files
with
243 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package webapis | ||
|
||
import ( | ||
"fmt" | ||
"github.com/openziti/xweb/v2" | ||
log "github.com/sirupsen/logrus" | ||
"strings" | ||
) | ||
|
||
const ( | ||
Binding = "zac" | ||
) | ||
|
||
type ZitiAdminConsoleFactory struct { | ||
} | ||
|
||
var _ xweb.ApiHandlerFactory = &ZitiAdminConsoleFactory{} | ||
|
||
func NewZitiAdminConsoleFactory() *ZitiAdminConsoleFactory { | ||
return &ZitiAdminConsoleFactory{} | ||
} | ||
|
||
func (factory *ZitiAdminConsoleFactory) Validate(*xweb.InstanceConfig) error { | ||
return nil | ||
} | ||
|
||
func (factory *ZitiAdminConsoleFactory) Binding() string { | ||
return Binding | ||
} | ||
|
||
func (factory *ZitiAdminConsoleFactory) New(_ *xweb.ServerConfig, options map[interface{}]interface{}) (xweb.ApiHandler, error) { | ||
locVal := options["location"] | ||
if locVal == nil || locVal == "" { | ||
return nil, fmt.Errorf("location must be supplied in the %s options", Binding) | ||
} | ||
|
||
loc, ok := locVal.(string) | ||
|
||
if !ok { | ||
return nil, fmt.Errorf("location must be a string for the %s options", Binding) | ||
} | ||
|
||
indexFileVal := options["indexFile"] | ||
indexFile := "index.html" | ||
|
||
if indexFileVal != nil { | ||
newFileVal, ok := indexFileVal.(string) | ||
|
||
if !ok { | ||
return nil, fmt.Errorf("indexFile must be a string for the %s options", Binding) | ||
} | ||
|
||
newFileVal = strings.TrimSpace(newFileVal) | ||
|
||
if newFileVal != "" { | ||
indexFile = newFileVal | ||
} | ||
} | ||
|
||
contextRoot := "/" + Binding | ||
spa := &GenericHttpHandler{ | ||
HttpHandler: SpaHandler(loc, contextRoot, indexFile), | ||
BindingKey: Binding, | ||
ContextRoot: contextRoot, | ||
} | ||
|
||
log.Infof("initializing ZAC SPA Handler from %s", locVal) | ||
return spa, nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.