You can install HST Spring Security Support with example configuration files by either automatically through Essentials or manually by editing some files in your project.
The first section below will describe how to install the module with example configuration files automatically through Essentials, and read the following section and the Configuration page if you want to install it manually.
In the essentials pom (essentials/pom.xml), add the following dependency:
<dependency>
<groupId>org.onehippo.forge.hst-springsec</groupId>
<artifactId>hst-springsec-essentials</artifactId>
<version>${hst-springsec.version}</version>
</dependency>
Now open /essentials/ in your web browser. Find HST Spring Security Support plugin and install it. It will ask you to rebuild and restart the project. After restarting it, HST Spring Security Support is already configured.
Essentials also copies all the configuration files explained in the Configuration page to your project.
In the main pom.xml of the project, in the repositories section, add this repository if it is not configured there yet.
<repository>
<id>bloomreach-forge</id>
<name>Bloomreach Forge maven 2 repository.</name>
<url>https://maven.bloomreach.com/repository/maven2-forge/</url>
</repository>
In the main pom.xml of the project, in the properties section, add this property. For the correct version number, check the Release Notes page.
<hst-springsec.version>version.number</hst-springsec.version>
Do not define spring-security.version yourself. It is inherited from the Bloomreach Experience Manager parent pom, so the Spring Security version always matches the Spring Framework version of the platform.
In the main pom.xml of the project, add these to the dependencyManagement section. The Spring Framework artifacts are excluded because they are already provided by Bloomreach Experience Manager.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring-security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring-security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring-security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.onehippo.forge.hst-springsec</groupId>
<artifactId>hst-springsec</artifactId>
<version>${hst-springsec.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Add these to the pom.xml of the site/components module. The versions and exclusions are inherited from the dependencyManagement section of the project pom.
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.onehippo.forge.hst-springsec</groupId>
<artifactId>hst-springsec</artifactId>
<scope>runtime</scope>
</dependency>
Finally, add the Spring Security configuration files described on the Configuration page. The SpringSecurityValve configuration is a Spring XML file in the HST assembly overrides folder of the site components, for example site/components/src/main/resources/META-INF/hst-assembly/overrides/spring-security.xml.