mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 04:35:40 +00:00
fix: split generic scopes string to array
This commit is contained in:
@@ -57,7 +57,7 @@ var rootCmd = &cobra.Command{
|
|||||||
HandleError(parseErr, "Failed to parse users")
|
HandleError(parseErr, "Failed to parse users")
|
||||||
|
|
||||||
// Create whitelist
|
// Create whitelist
|
||||||
whitelist := utils.ParseWhitelist(config.Whitelist)
|
whitelist := utils.ParseCommaString(config.Whitelist)
|
||||||
|
|
||||||
// Create OAuth config
|
// Create OAuth config
|
||||||
oauthConfig := types.OAuthConfig{
|
oauthConfig := types.OAuthConfig{
|
||||||
@@ -67,7 +67,7 @@ var rootCmd = &cobra.Command{
|
|||||||
GoogleClientSecret: config.GoogleClientSecret,
|
GoogleClientSecret: config.GoogleClientSecret,
|
||||||
GenericClientId: config.GenericClientId,
|
GenericClientId: config.GenericClientId,
|
||||||
GenericClientSecret: config.GenericClientSecret,
|
GenericClientSecret: config.GenericClientSecret,
|
||||||
GenericScopes: config.GenericScopes,
|
GenericScopes: utils.ParseCommaString(config.GenericScopes),
|
||||||
GenericAuthURL: config.GenericAuthURL,
|
GenericAuthURL: config.GenericAuthURL,
|
||||||
GenericTokenURL: config.GenericTokenURL,
|
GenericTokenURL: config.GenericTokenURL,
|
||||||
GenericUserURL: config.GenericUserURL,
|
GenericUserURL: config.GenericUserURL,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func (providers *Providers) Init() {
|
|||||||
ClientID: providers.Config.GenericClientId,
|
ClientID: providers.Config.GenericClientId,
|
||||||
ClientSecret: providers.Config.GenericClientSecret,
|
ClientSecret: providers.Config.GenericClientSecret,
|
||||||
RedirectURL: fmt.Sprintf("%s/api/oauth/callback/generic", providers.Config.AppURL),
|
RedirectURL: fmt.Sprintf("%s/api/oauth/callback/generic", providers.Config.AppURL),
|
||||||
Scopes: []string{providers.Config.GenericScopes},
|
Scopes: providers.Config.GenericScopes,
|
||||||
Endpoint: oauth2.Endpoint{
|
Endpoint: oauth2.Endpoint{
|
||||||
AuthURL: providers.Config.GenericAuthURL,
|
AuthURL: providers.Config.GenericAuthURL,
|
||||||
TokenURL: providers.Config.GenericTokenURL,
|
TokenURL: providers.Config.GenericTokenURL,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ type OAuthConfig struct {
|
|||||||
GoogleClientSecret string
|
GoogleClientSecret string
|
||||||
GenericClientId string
|
GenericClientId string
|
||||||
GenericClientSecret string
|
GenericClientSecret string
|
||||||
GenericScopes string
|
GenericScopes []string
|
||||||
GenericAuthURL string
|
GenericAuthURL string
|
||||||
GenericTokenURL string
|
GenericTokenURL string
|
||||||
GenericUserURL string
|
GenericUserURL string
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ func ParseFileToLine(content string) string {
|
|||||||
return strings.Join(users, ",")
|
return strings.Join(users, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseWhitelist(whitelist string) []string {
|
func ParseCommaString(str string) []string {
|
||||||
if whitelist == "" {
|
if str == "" {
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
return strings.Split(whitelist, ",")
|
return strings.Split(str, ",")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user