Addons

HOWTO: Override the Login Page - JSF UI

Updated: October 10, 2024

JSF UI Deprecation
This requires to have the JSF UI addon installed on your server that is deprecated since Nuxeo Platform LTS 2019.
Please refer to the Web UI documentation.

Login Page

The Login Page when the server is deployed is located at <nuxeo_server>/nxserver/nuxeo.war/login.jsp. In the source code, this page is located at nuxeo-platform-webapp/src/main/resources/nuxeo.war/login.jsp.

The easiest way to override it is to create a new JSP page with the exact same name and put it in at the root of the directory nuxeo.war of your bundle.

You will find more information related to the authentication here: Authentication.

An helper class will help you to access configuration for the login page, like the image to display on the background for example. The class is org.nuxeo.ecm.platform.ui.web.auth.LoginScreenHelper.

Here is an example getting few configuration data:

login.jsp

<%@ page import="org.nuxeo.ecm.platform.ui.web.auth.LoginScreenHelper"%>
<%
LoginScreenConfig screenConfig = LoginScreenHelper.getConfig();
// fetch Login Screen config and manage default
boolean showNews = screenConfig.getDisplayNews();
String iframeUrl = screenConfig.getNewsIframeUrl();
String bodyBackgroundStyle = LoginScreenHelper.getValueWithDefault(screenConfig.getBodyBackgroundStyle(), "url('" + context + "/img/login_bg.jpg') no-repeat center center fixed #333");
String headerStyle = LoginScreenHelper.getValueWithDefault(screenConfig.getHeaderStyle(), "");
String loginBoxBackgroundStyle = LoginScreenHelper.getValueWithDefault(screenConfig.getLoginBoxBackgroundStyle(), "none repeat scroll 0 0 #fff");
String footerStyle = LoginScreenHelper.getValueWithDefault(screenConfig.getFooterStyle(), "");
boolean disableBackgroundSizeCover = Boolean.TRUE.equals(screenConfig.getDisableBackgroundSizeCover());
String logoWidth = LoginScreenHelper.getValueWithDefault(screenConfig.getLogoWidth(), "113");
String logoHeight = LoginScreenHelper.getValueWithDefault(screenConfig.getLogoHeight(), "20");
String logoAlt = LoginScreenHelper.getValueWithDefault(screenConfig.getLogoAlt(), "Nuxeo");
String logoUrl = LoginScreenHelper.getValueWithDefault(screenConfig.getLogoUrl(), context + "/img/nuxeo_logo.png");
%>

Deployment

In order to be sure that your JSP page will override the default one, a modification must be added in the deployment-fragment.xml file of your bundle. In Nuxeo Platform, the module containing the login page is nuxeo-platform-webapp.

We want our bundle to be loaded after this module because our custom login page will override the default login page. To achieve this, add the following requirement in the deployment-fragment.xml, at the top of the file, just after the <fragment> tag.

<require>org.nuxeo.ecm.platform.web.common</require>