This sample demonstrates how to write a Spring Boot application that integrates with CICS security when deployed to a CICS Liberty JVM server.
The application uses Jakarta EE form authentication, validating user credentials using the Liberty SAF user registry. User roles are determined by Liberty configuration and passed to Spring Security for authorization checks. CICS uses the authenticated user ID when attaching the CICS task and for any CICS resource security checks.
Key Features:
- Jakarta EE form-based authentication with CICS Liberty SAF registry
- Spring Security pre-authentication using the container-authenticated identity
- Role-based access control using
cicsAllAuthenticatedsecurity role - Thymeleaf web templates for login and home pages
- Prerequisites
- Reference
- Downloading
- Check dependencies
- Building the Sample
- Deploying to a CICS Liberty JVM server
- Running the Sample
- License
- Additional Resources
- Contributing
- CICS TS V6.1 or later
- A configured Liberty JVM server in CICS
- Java SE 17 or later on the workstation
- Either Gradle or Apache Maven on the workstation (optional if using wrappers)
- IBM Developer tutorial: Spring Boot Java applications for CICS - Part 2 - Security
- Spring Security pre-authentication
- Clone the repository using your IDE's support, such as the Eclipse Git plugin
- or download the sample as a ZIP and unzip onto the workstation
Tip: Eclipse Git provides an Import existing Projects checkbox when cloning a repository.
Before building this sample, verify that the correct CICS TS bill of materials (BOM) is specified for your target release of CICS. The BOM specifies a consistent set of artifacts and their scope. You can browse published BOM versions at Maven Central.
The BOM version is centralised in:
- Gradle —
gradle.properties:cics.bom.version=6.1-20250812133513-PH63856 - Maven — root
pom.xml<properties>:<cics.bom.version>6.1-20250812133513-PH63856</cics.bom.version>
You can build the sample using an IDE of your choice, or from the command line. Using the supplied Gradle or Maven wrapper is the recommended approach for a consistent build tool version.
On Linux or Mac:
./gradlew clean buildOn Windows:
gradlew.bat clean buildOn Linux or Mac:
./mvnw clean verifyOn Windows:
mvnw.cmd clean verifyBoth commands produce a WAR file named cics-java-liberty-springboot-security.war — Gradle places it in cics-java-liberty-springboot-security-app/build/libs/, Maven in cics-java-liberty-springboot-security-app/target/.
Ensure your Liberty server.xml includes the following features:
<featureManager>
<feature>servlet-6.0</feature>
<feature>cicsts:security-1.0</feature>
</featureManager>Also ensure a SAF registry is configured in server.xml. A sample configuration is provided in etc/config/liberty/server.xml.
The sample includes a CICS bundle module (cics-java-liberty-springboot-security-cicsbundle) that uses the CICS Bundle Plugin to package and deploy the application.
- Build the project as described above — this produces a CICS bundle ZIP in the
cicsbundlemodule's output directory. - Upload and install the bundle ZIP to CICS using your preferred method (DFHDPLOY, zOS Management Facility, or CICS Explorer).
A pre-configured Eclipse CICS bundle project (cics-java-liberty-springboot-security-cicsbundle-eclipse) is included at the repository root.
- Import the repository into Eclipse (File → Import → General → Existing Projects into Workspace, select the repository root).
- Perform a Gradle Refresh or Maven Update Project to resolve dependencies.
- Right-click
cics-java-liberty-springboot-security-cicsbundle-eclipse→ Export Bundle Project to z/OS UNIX File System.
- Copy
cics-java-liberty-springboot-security.warto a zFS directory, for example${server.config.dir}/springapps/. - Add the following to your Liberty
server.xml, replacingMYUSERwith a valid SAF user ID:
<application id="cics-java-liberty-springboot-security"
location="${server.config.dir}/springapps/cics-java-liberty-springboot-security.war"
name="cics-java-liberty-springboot-security" type="war">
<application-bnd>
<security-role name="cicsAllAuthenticated">
<user name="MYUSER"/>
</security-role>
</application-bnd>
</application>Alternatively, use Liberty SAF authorization with EJBROLE profiles to grant users access to the cicsAllAuthenticated role.
-
Ensure the web application started successfully in Liberty by checking for message
CWWKT0016Iinmessages.log:CWWKT0016I: Web application available (default_host): http://myzos.mycompany.com:httpPort/cics-java-liberty-springboot-security -
Open the URL in a browser and log in using a user ID that has been granted the
cicsAllAuthenticatedrole. -
You should see the application home page, confirming that authentication and authorization succeeded.
This project is licensed under the Eclipse Public License - v 2.0.
- Developing Spring Boot applications for CICS
- Configuring a Liberty JVM server
- CICS TS BOM on Maven Central
This sample is maintained by IBM CICS development. We welcome bug reports and feature requests via GitHub Issues. Contributions are welcome and reviewed on a case-by-case basis — please read the contributing guidelines before opening a pull request. For CICS product questions, contact IBM Support.