Compare commits

..

2 Commits

Author SHA1 Message Date
dependabot[bot]
b5eaf05629 chore(deps): bump github.com/gin-gonic/gin in the minor-patch group
Bumps the minor-patch group with 1 update: [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin).


Updates `github.com/gin-gonic/gin` from 1.10.1 to 1.11.0
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gin-gonic/gin/compare/v1.10.1...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/gin-gonic/gin
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-26 08:17:29 +00:00
Stavros
085f6257c5 fix: fix oauth group provider check 2025-09-25 22:35:44 +03:00
4 changed files with 17 additions and 15 deletions

View File

@@ -147,10 +147,6 @@ func (app *BootstrapApp) Setup() error {
}
// Configured providers
babysit := map[string]string{
"google": "Google",
"github": "GitHub",
}
configuredProviders := make([]controller.Provider, 0)
for id, provider := range oauthProviders {
@@ -159,7 +155,7 @@ func (app *BootstrapApp) Setup() error {
}
if provider.Name == "" {
if name, ok := babysit[id]; ok {
if name, ok := config.OverrideProviders[id]; ok {
provider.Name = name
} else {
provider.Name = utils.Capitalize(id)

View File

@@ -65,6 +65,11 @@ type OAuthServiceConfig struct {
Name string `key:"name"`
}
var OverrideProviders = map[string]string{
"google": "Google",
"github": "GitHub",
}
// User/session related stuff
type User struct {

View File

@@ -309,12 +309,14 @@ func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserConte
return true
}
if context.Provider != "generic" {
log.Debug().Msg("Not using generic provider, skipping group check")
return true
for id := range config.OverrideProviders {
if context.Provider == id {
log.Info().Str("provider", id).Msg("OAuth groups not supported for this provider")
return true
}
}
for _, userGroup := range strings.Split(context.OAuthGroups, ",") {
for userGroup := range strings.SplitSeq(context.OAuthGroups, ",") {
if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) {
return true
}

View File

@@ -183,14 +183,13 @@ func GetOAuthProvidersConfig(env []string, args []string, appUrl string) (map[st
providers[name] = provider
}
// If we have google/github providers and no redirect URL babysit them
babysitProviders := []string{"google", "github"}
// If we have google/github providers and no redirect URL then set a default
for _, name := range babysitProviders {
if provider, exists := providers[name]; exists {
for id := range config.OverrideProviders {
if provider, exists := providers[id]; exists {
if provider.RedirectURL == "" {
provider.RedirectURL = appUrl + "/api/oauth/callback/" + name
providers[name] = provider
provider.RedirectURL = appUrl + "/api/oauth/callback/" + id
providers[id] = provider
}
}
}