You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wg-access-server/pkg/authnz/authconfig/authconfig.go

34 lines
694 B
Go

package authconfig
import (
"github.com/place1/wg-access-server/pkg/authnz/authruntime"
)
type AuthConfig struct {
OIDC *OIDCConfig `yaml:"oidc"`
Gitlab *GitlabConfig `yaml:"gitlab"`
Basic *BasicAuthConfig `yaml:"basic"`
}
func (c *AuthConfig) IsEnabled() bool {
return c.OIDC != nil || c.Gitlab != nil || c.Basic != nil
}
func (c *AuthConfig) Providers() []*authruntime.Provider {
providers := []*authruntime.Provider{}
if c.OIDC != nil {
providers = append(providers, c.OIDC.Provider())
}
if c.Gitlab != nil {
providers = append(providers, c.Gitlab.Provider())
}
if c.Basic != nil {
providers = append(providers, c.Basic.Provider())
}
return providers
}