fix: Getting branding assets from Eclipse Che Dashboard should not require authentiction (#1708)

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
pull/1709/head
Anatolii Bazko 2023-06-15 13:58:24 +02:00 committed by GitHub
parent 4b5a62a523
commit 94934bfe17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -162,7 +162,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {
configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Errorf("oauth config shold not contain any skip auth when both registries are external")
}
})
@ -183,7 +183,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {
configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for devfile registry", config)
}
})
@ -204,7 +204,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {
configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for plugin registry", config)
}
})
@ -225,7 +225,7 @@ func TestOauthProxyConfigUnauthorizedPaths(t *testing.T) {
configmap := getGatewayOauthProxyConfigSpec(ctx, "blabol")
config := configmap.Data["oauth-proxy.cfg"]
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload\"") {
if !strings.Contains(config, "skip_auth_regex = \"^/plugin-registry|^/devfile-registry|^/$|/healthz$|^/dashboard/static/preload|^/dashboard/assets/branding/loader.svg$\"") {
t.Error("oauth config should skip auth for plugin and devfile registry.", config)
}
})

View File

@ -146,6 +146,7 @@ func skipAuthConfig(instance *chev2.CheCluster) string {
skipAuthPaths = append(skipAuthPaths, "^/$")
skipAuthPaths = append(skipAuthPaths, "/healthz$")
skipAuthPaths = append(skipAuthPaths, "^/dashboard/static/preload")
skipAuthPaths = append(skipAuthPaths, fmt.Sprintf("^%s$", defaults.GetConsoleLinkImage()))
if len(skipAuthPaths) > 0 {
propName := "skip_auth_routes"
if infrastructure.IsOpenShift() {