mirror of
https://github.com/openziti/zrok.git
synced 2025-08-10 00:17:46 +02:00
generalized implementation of public/private share (#34)
This commit is contained in:
30
sdk/config.go
Normal file
30
sdk/config.go
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user