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>org.broadleafcommerce</groupId>
<artifactId>broadleaf-account</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
Data Changes
Schema Changes
To add all of the necessary database tables and columns for this module, please follow the Liquibase update documentation.
Demo Data
Demo data that sets up account data is included in classpath:/config/bc/sql/samples
.
Demo Site Code Changes
To inform Spring Security about the current account customer's roles, you must use the blAccountUserDetailsService
in the applicationContext-security.xml
file of your site
:
<!-- The BLC Authentication manager. -->
<sec:authentication-manager alias="blAuthenticationManager">
<sec:authentication-provider user-service-ref="blAccountUserDetailsService">
<sec:password-encoder ref="blPasswordEncoder"/>
</sec:authentication-provider>
</sec:authentication-manager>
Account related functionality:
The account module provides several controllers to handle several basic account related features. For example,
the ability to perform basic account maintenance, the ability to submit an order for approval, and the ability to
approve or reject an order that is pending approval. Please see the javadocs for the controllers provided out-of-box
for more details.
Additional Steps for Non-Spring Boot Projects
- To put the account of the logged in customer on the request you must specify the
blAccountRequestFilter
in yourapplicationContext-filter.xml
file of yoursite
, after theblCustomerStateFilter
:
<bean id="blPostSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
<sec:filter-chain-map request-matcher="ant">
<sec:filter-chain pattern="/**" filters="
blRequestFilter,
blCustomerStateFilter,
...,
blAccountRequestFilter,
...,
blCartStateFilter"/>
</sec:filter-chain-map>
</bean>
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.