Advisor: Add checks for list validation for SSO Settings service (#104520)
* Add format validation for allowed_organizations and allowed_groups * Refactor, introduce ListFormatValidation * Add tests * Update apps/advisor/pkg/app/checks/authchecks/list_format_validation.go Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com> * Update apps/advisor/pkg/app/checks/authchecks/list_format_validation.go Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com> * Use one step instead of multiple separate ones --------- Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
This commit is contained in:
co-authored by
Andres Martinez Gotor
parent
ddf33bcb66
commit
7d1eda2e5e
@@ -2,6 +2,7 @@ package login
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type AuthInfoService interface {
|
||||
@@ -56,22 +57,23 @@ const (
|
||||
OktaLabel = "Okta"
|
||||
)
|
||||
|
||||
// used for frontend to display a more user friendly label
|
||||
// GetAuthProviderLabel returns the label for the given auth module.
|
||||
// Used for frontend to display a more user friendly label.
|
||||
func GetAuthProviderLabel(authModule string) string {
|
||||
switch authModule {
|
||||
case GithubAuthModule:
|
||||
case GithubAuthModule, strings.TrimPrefix(GithubAuthModule, "oauth_"):
|
||||
return GithubLabel
|
||||
case GoogleAuthModule:
|
||||
case GoogleAuthModule, strings.TrimPrefix(GoogleAuthModule, "oauth_"):
|
||||
return GoogleLabel
|
||||
case AzureADAuthModule:
|
||||
case AzureADAuthModule, strings.TrimPrefix(AzureADAuthModule, "oauth_"):
|
||||
return AzureADLabel
|
||||
case GitLabAuthModule:
|
||||
case GitLabAuthModule, strings.TrimPrefix(GitLabAuthModule, "oauth_"):
|
||||
return GitLabLabel
|
||||
case OktaAuthModule:
|
||||
case OktaAuthModule, strings.TrimPrefix(OktaAuthModule, "oauth_"):
|
||||
return OktaLabel
|
||||
case GrafanaComAuthModule, GrafanaNetAuthModule:
|
||||
case GrafanaComAuthModule, GrafanaNetAuthModule, strings.TrimPrefix(GrafanaComAuthModule, "oauth_"), strings.TrimPrefix(GrafanaNetAuthModule, "oauth_"):
|
||||
return GrafanaComLabel
|
||||
case SAMLAuthModule:
|
||||
case SAMLAuthModule, strings.TrimPrefix(SAMLAuthModule, "auth."):
|
||||
return SAMLLabel
|
||||
case LDAPAuthModule, "": // FIXME: verify this situation doesn't exist anymore
|
||||
return LDAPLabel
|
||||
@@ -79,7 +81,7 @@ func GetAuthProviderLabel(authModule string) string {
|
||||
return JWTLabel
|
||||
case AuthProxyAuthModule:
|
||||
return AuthProxyLabel
|
||||
case GenericOAuthModule:
|
||||
case GenericOAuthModule, strings.TrimPrefix(GenericOAuthModule, "oauth_"):
|
||||
return GenericOAuthLabel
|
||||
default:
|
||||
return "Unknown"
|
||||
|
||||
Reference in New Issue
Block a user