Delivery Tier Authentication Configuration
Note: This documentation is scheduled for verification and may contain outdated information.
Overview
This page describes the default authentication configuration for the delivery tier in Bloomreach Content. It explains the standard setup, outlines customization options, and provides references to related topics.
Default Authentication in the Delivery Tier
Bloomreach Content's delivery framework (HST) provides built-in authentication using JAAS (Java Authentication and Authorization Service). Projects generated with the Maven archetype are pre-configured for form-based authentication over HTTPS. This uses the default LoginModule implementation included in HST.
When an unauthenticated user requests a page that requires authorization, the system redirects the user to the login form.
For alternative authentication approaches or further customization, see:
- Configure the Delivery Tier to Use Basic Authentication
- Customize the Delivery Tier Authentication Provider
- Customize the Delivery Tier's Form Login Pages
Info: The HST Spring Security Support forge project provides an authentication provider for the repository and a Spring Security-aware Security Valve. This allows you to use Spring Security instead of the default JAAS-based security module.
JAAS Login Configuration
Default JAAS Configuration
The delivery framework includes a default JAAS login configuration file. This file configures the default LoginModule implementation: org.hippoecm.hst.security.impl.DefaultLoginModule.
Using a Custom LoginModule
To use a different LoginModule implementation:
-
Place your custom
LoginModuleclass in the site web application. For example:site/src/main/java/org/example/MyLoginModule.java. -
Define the custom
LoginModulein a JAAS login configuration file, such asconf/login.conf:HSTSITE { org.example.MyLoginModule required debug="false" storePrivCreds="true"; }; -
Specify the location of the JAAS login configuration file in the CMS web application's
hst-config.properties(typicallycms/webapp/src/main/webapp/WEB-INF/hst-config.properties):java.security.auth.login.config = file:/${catalina.base}/conf/login.conf -
Configure the authentication realm and valve in the application context file (
site/webapp/src/main/webapp/META-INF/context.xml):<Context crossContext="true"> <Realm className="org.apache.catalina.realm.JAASRealm" appName="HSTSITE" userClassNames="org.hippoecm.hst.security.TransientUser" roleClassNames="org.hippoecm.hst.security.TransientRole" useContextClassLoader="true"/> <Valve className="org.apache.catalina.authenticator.FormAuthenticator" characterEncoding="UTF-8"/> </Context>The realm name must match the value configured in
web.xml. By default, the configuration uses form-based authentication with theFormAuthenticatorvalve. To use basic authentication, refer to Configure the Delivery Tier to Use Basic Authentication.Note: Configure the Realm in
site/webapp/src/main/webapp/META-INF/context.xml, not inconf/context.xml.Hint: Multiple Delivery Webapps
If your project includes multiple delivery web applications, you can define a separate
LoginModulefor each. Add additional app entries inconf/login.confand configure corresponding realms in each webapp'sMETA-INF/context.xml. -
Ensure that
login.confis present in the Tomcatconfdirectory.-
For local development using cargo:run, add the following to
build/plugins/plugin/configuration/configuration/configfilesin your rootpom.xml:<configfile> <file>${project.basedir}/conf/login.conf</file> <todir>conf/</todir> <tofile>login.conf</tofile> </configfile> -
For deployment with a project distribution, add this entry to
src/main/assembly/conf-component.xml:<file> <source>conf/login.conf</source> <outputDirectory>conf</outputDirectory> <destName>login.conf</destName> </file>
-
Servlet Configuration
Form-based authentication is handled by the LoginServlet, configured in site/webapp/src/main/webapp/WEB-INF/web.xml:
<servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>org.hippoecm.hst.security.servlet.LoginServlet </servlet-class> </servlet>
<servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/login/*</url-pattern> </servlet-mapping>
<security-constraint> <web-resource-collection> <web-resource-name>Login</web-resource-name> <url-pattern>/login/resource</url-pattern> </web-resource-collection> <auth-constraint> <role-name>everybody</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>FORM</auth-method> <realm-name>HSTSITE</realm-name> <form-login-config> <form-login-page>/login/login</form-login-page> <form-error-page>/login/error</form-error-page> </form-login-config> </login-config> <security-role> <description>Default role of the repository</description> <role-name>everybody</role-name> </security-role>
This configuration:
- Protects the
/login/resourcepath, which is used internally byLoginServlet. - Enables form-based authentication with specified login and error page paths.
- Requires the
everybodyrole for the protected resource, used for authentication purposes only.
Login Form Skin Resources
Default Skin Resource Configuration
The default login form references built-in skin resources (such as CSS and images). These are served by the SecurityResourceServlet, configured in site/webapp/src/main/webapp/WEB-INF/web.xml:
<servlet> <servlet-name>SecurityResourceServlet</servlet-name> <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class> <init-param> <param-name>jarPathPrefix</param-name> <param-value>/META-INF/hst/security</param-value> </init-param> </servlet>
<servlet-mapping> <servlet-name>SecurityResourceServlet</servlet-name> <url-pattern>/login/hst/security/*</url-pattern> </servlet-mapping>
Overriding Login Form CSS
To customize the appearance of the login form, override the default CSS:
- Create a file at
src/main/resources/META-INF/hst/security/skin/screen.cssin either thesite/componentsorsite/webappmodule. - The system will use your custom CSS instead of the default.
HTTPS vs HTTP Login
By default, all login requests in the delivery framework use HTTPS.
For a standard Cargo-based development environment, you can enable HTTPS by:
- Configuring Cargo for SSL/TLS
- Configuring Apache HTTP Server as a Reverse Proxy. See also Apache HTTP Server's SSL/TLS and mod_ssl documentation.
To use HTTP for login (for local development only):
-
Open the Console.
-
Navigate to
/hst:hst/hst:configurations/hst:default/hst:sitemap/login. -
Change the value of the
hst:schemeproperty fromhttpstohttp:/hst:hst/hst:configurations/hst:default/hst:sitemap: /login: jcr:primaryType: hst:sitemapitem hst:scheme: http
Testing the Login Form
To verify the login form:
- Open your browser and navigate to
/login/form. For a standard local project, usehttp://localhost:8080/site/login/form. - Enter a valid CMS username and password. The system should authenticate you.
- If you enter invalid credentials, you will be redirected to
/login/error.
To check authentication status in delivery framework components, call HttpServletRequest#getUserPrincipal(). If this method returns a non-null value, the user is authenticated.