generalized implementation of public/private share (#34)

This commit is contained in:
Michael Quigley
2023-07-17 16:45:20 -04:00
parent c0503ae593
commit c26d325f61
17 changed files with 153 additions and 76 deletions

30
sdk/config.go Normal file
View File

@ -0,0 +1,30 @@
package sdk
import "github.com/pkg/errors"
const ZrokProxyConfig = "zrok.proxy.v1"
type ProxyConfig struct {
AuthScheme AuthScheme `json:"auth_scheme"`
BasicAuth *BasicAuth `json:"basic_auth"`
}
type BasicAuth struct {
Users []*AuthUser `json:"users"`
}
type AuthUser struct {
Username string `json:"username"`
Password string `json:"password"`
}
func ParseAuthScheme(authScheme string) (AuthScheme, error) {
switch authScheme {
case string(None):
return None, nil
case string(Basic):
return Basic, nil
default:
return None, errors.Errorf("unknown auth scheme '%v'", authScheme)
}
}