add user scripting with lua
This commit is contained in:
@@ -19,6 +19,12 @@ type OAuthProvider struct {
|
||||
ClientID string `toml:"client_id"`
|
||||
ClientSecret string `toml:"client_secret"`
|
||||
RedirectURL string `toml:"redirect_url"`
|
||||
|
||||
// Only for custom OAuth provider
|
||||
AuthURL string `toml:"auth_url"`
|
||||
TokenURL string `toml:"token_url"`
|
||||
Scopes []string `toml:"scopes"`
|
||||
Script string `toml:"info_script"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -50,6 +56,15 @@ func LoadConfig() (Config, oauth2.Config, error) {
|
||||
case "google":
|
||||
oa2.Endpoint = endpoints.Google
|
||||
oa2.Scopes = []string{"https://www.googleapis.com/auth/userinfo.email"}
|
||||
default:
|
||||
oa2.Endpoint = oauth2.Endpoint{
|
||||
AuthURL: config.OAuthProvider.AuthURL,
|
||||
TokenURL: config.OAuthProvider.TokenURL,
|
||||
}
|
||||
oa2.Scopes = config.OAuthProvider.Scopes
|
||||
if config.OAuthProvider.Script == "" {
|
||||
panic("no script provided")
|
||||
}
|
||||
}
|
||||
|
||||
return config, oa2, err
|
||||
|
||||
Reference in New Issue
Block a user