Module Installation
Steps to enable this module in your custom Broadleaf Commerce project
Steps
Step 1 Pull this dependency into your core/pom.xml
:
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-multitenant-singleschema</artifactId>
</dependency>
This assumes that you are using the Broadleaf BOM that pins all version information. If not, you will need to also add a
<version>
qualifier
Step 2 In applicationContext-admin-security.xml
, add the following three lines to the sec:filter-security-metadata-source
section of the blAdminFilterSecurityInterceptor
bean:
xml
<sec:intercept-url pattern="/global" access="PERMISSION_GLOBAL_ADMIN" />
<sec:intercept-url pattern="/global-*" access="PERMISSION_GLOBAL_ADMIN" />
<sec:intercept-url pattern="/global-*/**/*" access="PERMISSION_GLOBAL_ADMIN" />
> Note: These lines should be the first lines in the section
Step 3 In the same applicationContext-admin-security.xml
file, add following bean:
xml
<bean id="blAdminLogoutSuccessHandler" class="com.broadleafcommerce.tenant.admin.web.BroadleafMultiTenantAdminLogoutSuccessHandler"/>
Step 4 In the same applicationContext-admin-security.xml
file, replace the sec:logout
definition with:
xml
<sec:logout invalidate-session="false" logout-url="/adminLogout.htm" success-handler-ref="blAdminLogoutSuccessHandler"/>
Step 5 Ensure load time weaving is enabled for your application server. Enabling load time weaving
Step 6 If you have a non-Spring Boot project, then in applicationContext-admin-filter.xml
, add the following filter as the last filter in the blPreSecurityFilterChain
:
xml
blMultiTenantAdminRequestFilter
> Note: If you have a Spring Boot based project, then this step is not necessary. In that case, the filter will be automatically ordered according to its org.springframework.core.Ordered#getOrder()
return value, when the resource is registered with Spring.
Data Changes
Schema Changes
To add all of the necessary database tables and columns for this module, please follow the Liquibase update documentation.
Admin Security Changes
The data in the following SQL file is required to establish Admin sections and permissions for this module:
classpath:/config/bc/sql/load_multitenant_admin_security.sql
This file is automatically included if you have set blPU.hibernate.hbm2ddl.auto=create
and you have not set import.sql.enabled=false
in your properties files. If you are not using Hibernate's auto DDL process and are using Liquibase, you can add a new changeSet
that references this file:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet author="broadleaf" id="some-unique-id">
<sqlFile path="config/bc/sql/load_multitenant_admin_security.sql" encoding="utf8" stripComments="true" />
</changeSet>
</databaseChangeLog>
Finally, you can unpack the downloaded .jar
file and look at the files in the config/bc/sql
folder to execute this sql manually.
IMPORTANT NOTE: This will give your project the basis for having site-specific admins. However, the SQL statements in those files will not account for which of your existing admin users should be mapped to which sites. This is something that must be controlled manually. Please consult the [[Security Contexts Guide]] for more information. You will likely see a blank screen until you follow these instructions.
Next Steps
We recommend that after getting the module configured, start your demo site and admin to ensure that you don't have any errors.
Once you start up successfully, move on to the Getting Started section which will help you to setup a couple of sites.