feat: initial commit
This commit is contained in:
33
internal/config/auth.go
Normal file
33
internal/config/auth.go
Normal file
@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
type Auth struct {
|
||||
Providers AuthProviders `envPrefix:"PROVIDERS_"`
|
||||
}
|
||||
|
||||
type AuthProviders struct {
|
||||
Google OAuth2Provider `envPrefix:"GOOGLE_"`
|
||||
Github OAuth2Provider `envPrefix:"GITHUB_"`
|
||||
Gitea GiteaProvider `envPrefix:"GITEA_"`
|
||||
OIDC OIDCProvider `envPrefix:"OIDC_"`
|
||||
}
|
||||
|
||||
type OAuth2Provider struct {
|
||||
Key string `env:"KEY,expand"`
|
||||
Secret string `env:"SECRET,expand"`
|
||||
Scopes []string `env:"SCOPES,expand"`
|
||||
}
|
||||
|
||||
type OIDCProvider struct {
|
||||
OAuth2Provider
|
||||
DiscoveryURL string `env:"DISCOVERY_URL,expand"`
|
||||
Icon string `env:"ICON,expand" envDefault:"fa-passport"`
|
||||
Label string `env:"LABEL,expand" envDefault:"OpenID Connect"`
|
||||
}
|
||||
|
||||
type GiteaProvider struct {
|
||||
OAuth2Provider
|
||||
TokenURL string `env:"TOKEN_URL,expand"`
|
||||
AuthURL string `env:"AUTH_URL,expand"`
|
||||
ProfileURL string `env:"PROFILE_URL,expand"`
|
||||
Label string `env:"LABEL,expand" envDefault:"Gitea"`
|
||||
}
|
Reference in New Issue
Block a user