diff --git a/server/src/main/java/org/cloudfoundry/identity/uaa/zone/MergedZoneBrandingInformation.java b/server/src/main/java/org/cloudfoundry/identity/uaa/zone/MergedZoneBrandingInformation.java index f059575d619..022bc1f5a32 100644 --- a/server/src/main/java/org/cloudfoundry/identity/uaa/zone/MergedZoneBrandingInformation.java +++ b/server/src/main/java/org/cloudfoundry/identity/uaa/zone/MergedZoneBrandingInformation.java @@ -33,6 +33,14 @@ public String getProductLogo() { return tryGet(IdentityZoneHolder.get(), BrandingInformationSource::getProductLogo).orElse(null); } + public String getInlinedBase64PngLogo() { + String logo = getProductLogo(); + if ( logo != null ) { + logo = "data:image/png;base64," + logo; + } + return logo; + } + @Override public String getSquareLogo() { return resolve(BrandingInformationSource::getSquareLogo); diff --git a/server/src/main/resources/templates/web/layouts/main.html b/server/src/main/resources/templates/web/layouts/main.html index 9d6fcad646a..9e00f2f6bc7 100644 --- a/server/src/main/resources/templates/web/layouts/main.html +++ b/server/src/main/resources/templates/web/layouts/main.html @@ -8,9 +8,9 @@ copyrightCompanyName=${branding.getCompanyName() ?: 'CloudFoundry.org Foundation, Inc. '}, copyrightFallback=${'Copyright © ' + copyrightCompanyName + ' ' + #dates.year(#dates.createNow()) + '. All Rights Reserved.'}, copyright=${branding.getFooterLegalText() ?: copyrightFallback}, - brandingLogo=${branding.getProductLogo()}, + brandingLogo=${branding.getInlinedBase64PngLogo()}, fallbackLogo=${isUaa ? assetBaseUrl+'/images/product-logo.png' : null}, - logo=${brandingLogo != null ? 'data:image/png;base64,'+#strings.replace(brandingLogo,T(java.lang.System).getProperty('line.separator'),'') : fallbackLogo}" > + logo=${brandingLogo != null ? #strings.replace(brandingLogo,T(java.lang.System).getProperty('line.separator'),'') : fallbackLogo}" > diff --git a/server/src/main/resources/templates/web/layouts/pui-account-discovery-main.html b/server/src/main/resources/templates/web/layouts/pui-account-discovery-main.html index 20defaa8ed1..f8ee9a23c74 100644 --- a/server/src/main/resources/templates/web/layouts/pui-account-discovery-main.html +++ b/server/src/main/resources/templates/web/layouts/pui-account-discovery-main.html @@ -42,7 +42,7 @@
- +

Cloud Foundry

diff --git a/server/src/main/resources/templates/web/layouts/pui-mfa-main.html b/server/src/main/resources/templates/web/layouts/pui-mfa-main.html index ee38dce74ac..6f5bbcb92e0 100644 --- a/server/src/main/resources/templates/web/layouts/pui-mfa-main.html +++ b/server/src/main/resources/templates/web/layouts/pui-mfa-main.html @@ -42,7 +42,7 @@
- +

Cloud Foundry

diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/LoginMockMvcTests.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/LoginMockMvcTests.java index 7805ecaabb5..9aa3247351d 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/LoginMockMvcTests.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/LoginMockMvcTests.java @@ -636,6 +636,15 @@ void testCustomFavIcon() throws Exception { .andExpect(content().string(allOf(containsString(""), not(containsString("square-logo.png"))))); } + @Test + void testProductLogoOver100kChars() throws Exception { + String bigLogo = new String(new char[150000]).replace('\0', 'x'); + setZoneFavIconAndProductLogo(webApplicationContext, identityZoneConfiguration, null, bigLogo); + + mockMvc.perform(get("/login")) + .andExpect(content().string(allOf(containsString(""), not(containsString("product-logo.png"))))); + } + @Test void testCustomFavIcon_With_LineBreaks() throws Exception { setZoneFavIconAndProductLogo(webApplicationContext, identityZoneConfiguration, "/sM4\n\nlL==", "/sM4\n\nlL==");