mirror of
https://github.com/openziti/zrok.git
synced 2025-08-10 00:17:46 +02:00
Merge branch 'main' into oauth-testing
This commit is contained in:
38
sdk/config.go
Normal file
38
sdk/config.go
Normal file
@ -0,0 +1,38 @@
|
||||
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"`
|
||||
OauthAuth *OauthAuth `json:"oauth"`
|
||||
}
|
||||
|
||||
type BasicAuth struct {
|
||||
Users []*AuthUser `json:"users"`
|
||||
}
|
||||
|
||||
type AuthUser struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type OauthAuth struct {
|
||||
Provider string `json:"provider"`
|
||||
EmailDomains []string `json:"email_domains"`
|
||||
}
|
||||
|
||||
func ParseAuthScheme(authScheme string) (AuthScheme, error) {
|
||||
switch authScheme {
|
||||
case string(None):
|
||||
return None, nil
|
||||
case string(Basic):
|
||||
return Basic, nil
|
||||
case string(Oauth):
|
||||
return Oauth, nil
|
||||
default:
|
||||
return None, errors.Errorf("unknown auth scheme '%v'", authScheme)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user