SSO: update info field from SocialBase struct (#83407)

update info field from SocialBase struct
This commit is contained in:
Mihai Doarna
2024-02-26 18:02:46 +02:00
committed by GitHub
parent 2c38bc5f13
commit 7b2fa28e0b
8 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ func (s *SocialAzureAD) Reload(ctx context.Context, settings ssoModels.SSOSettin
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.AzureADProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.AzureADProviderName, newInfo)
if newInfo.UseRefreshToken {
appendUniqueScope(s.Config, social.OfflineAccessScope)
+1 -1
View File
@@ -116,7 +116,7 @@ func (s *SocialGenericOAuth) Reload(ctx context.Context, settings ssoModels.SSOS
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.GenericOAuthProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.GenericOAuthProviderName, newInfo)
s.teamsUrl = newInfo.TeamsUrl
s.emailAttributeName = newInfo.EmailAttributeName
+1 -1
View File
@@ -121,7 +121,7 @@ func (s *SocialGithub) Reload(ctx context.Context, settings ssoModels.SSOSetting
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.GitHubProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.GitHubProviderName, newInfo)
s.teamIds = teamIds
s.allowedOrganizations = util.SplitString(newInfo.Extra[allowedOrganizationsKey])
+1 -1
View File
@@ -92,7 +92,7 @@ func (s *SocialGitlab) Reload(ctx context.Context, settings ssoModels.SSOSetting
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.GitlabProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.GitlabProviderName, newInfo)
return nil
}
+1 -1
View File
@@ -88,7 +88,7 @@ func (s *SocialGoogle) Reload(ctx context.Context, settings ssoModels.SSOSetting
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.GoogleProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.GoogleProviderName, newInfo)
return nil
}
@@ -85,7 +85,7 @@ func (s *SocialGrafanaCom) Reload(ctx context.Context, settings ssoModels.SSOSet
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.GrafanaComProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.GrafanaComProviderName, newInfo)
s.url = s.cfg.GrafanaComURL
s.allowedOrganizations = util.SplitString(newInfo.Extra[allowedOrganizationsKey])
+1 -1
View File
@@ -88,7 +88,7 @@ func (s *SocialOkta) Reload(ctx context.Context, settings ssoModels.SSOSettings)
s.reloadMutex.Lock()
defer s.reloadMutex.Unlock()
s.SocialBase = newSocialBase(social.OktaProviderName, newInfo, s.features, s.cfg)
s.updateInfo(social.OktaProviderName, newInfo)
if newInfo.UseRefreshToken {
appendUniqueScope(s.Config, social.OfflineAccessScope)
}
@@ -50,6 +50,11 @@ func newSocialBase(name string,
}
}
func (s *SocialBase) updateInfo(name string, info *social.OAuthInfo) {
s.Config = createOAuthConfig(info, s.cfg, name)
s.info = info
}
type groupStruct struct {
Groups []string `json:"groups"`
}