Mirror of Apache Directory Fortress Enmasse

Clone this repo:
  1. 5c5cbd6 Merge pull request #12 from apache/dependabot/maven/org.springframework-spring-core-6.0.16 by Shawn McKinney · 3 months ago master
  2. e806cdf Bump org.springframework:spring-core from 6.0.15 to 6.0.16 by dependabot[bot] · 3 months ago
  3. 6df4f6f Merge pull request #10 from apache/dependabot/maven/org.springframework-spring-core-6.0.15 by Shawn McKinney · 3 months ago
  4. 65427d8 Merge pull request #11 from apache/dependabot/maven/org.apache.cxf-cxf-core-4.0.4 by Shawn McKinney · 3 months ago
  5. ac44a61 Bump org.apache.cxf:cxf-core from 4.0.2 to 4.0.4 by dependabot[bot] · 3 months ago

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

README for Apache Fortress Rest

  • Version 3.0.0
  • Apache Fortress Rest System Architecture Diagram Apache Fortress Rest System Architecture

Table of Contents

  • Document Overview
  • About Apache Fortress Rest
  • Tips for first-time users.
  • SECTION 1. Prerequisites.
  • SECTION 2. Download & Install.
  • SECTION 3. Prepare Tomcat for Java EE Security
  • SECTION 4. Prepare directory-fortress-rest package to use LDAP server
  • SECTION 5. Build and deploy directory-fortress-rest
  • SECTION 6. Unit Test.
  • SECTION 7. Fortress rest properties

Document Overview

This document contains instructions to download, build, and test operations using Apache Fortress Rest component.

About Apache Fortress Rest

  • An http service interface to drive Apache Fortress APIs.

  • Uses Apache CXF as the rest framework.

  • Layered security using ...

    • declarative controls:
      • HTTP Basic Authentication and coarse-grained role check (Tomcat Realm)
      • Service security using Apache CXF's SimpleAuthorizingInterceptor
    • programmatic controls:
      • fine-grained authorization

Tips for first-time users

SECTION 1. Prerequisites

Minimum software requirements:

Everything else covered in steps that follow. Tested on Debian and Redhat systems.

SECTION 2. Download & Install

1. Download the source.

a. from git:

git clone --branch [version] https://gitbox.apache.org/repos/asf/directory-fortress-enmasse.git
cd directory-fortress-enmasse

b. or apache fortress downloads

2. Build the source.

mvn clean install

3. Now build the javadoc:

mvn javadoc:javadoc

4. View the generated document here: ./target/site/apidocs/overview-summary.html.

SECTION 3. Prepare Tomcat for Java EE Security

This web app uses Java EE security.

1. Download the fortress realm proxy jar into tomcat/lib folder:

wget https://repo.maven.apache.org/maven2/org/apache/directory/fortress/fortress-realm-proxy/[version]/fortress-realm-proxy-[version].jar -P $TOMCAT_HOME/lib
  • Where $TOMCAT_HOME points to the execution env.
  • Where [version] points to the particular release, e.g. 3.0.0.

Note: The realm proxy enables Tomcat container-managed security functions to call back to fortress.

2. Optional - Prepare tomcat to allow autodeploy of rbac-abac-sample web app:

sudo vi /usr/local/tomcat10/conf/tomcat-users.xml

3. Optional - Add tomcat user to deploy rbac-abac-sample:

<role rolename="manager-script"/>
<user username="tcmanager" password="m@nager123" roles="manager-script"/>

4. Restart tomcat for new settings to take effect.

SECTION 4. Prepare directory-fortress-rest package to use LDAP server

1. Copy the fortress.properties example:

cp src/main/resources/fortress.properties.example src/main/resources/fortress.properties

2. Edit the file:

vi src/main/resources/fortress.properties

Pick either Apache Directory or OpenLDAP server:

a. Prepare fortress for ApacheDS usage:

# This param tells fortress what type of ldap server in use:

# Use value from [Set Hostname Entry]:

# ApacheDS defaults to this:

# These credentials are used for read/write access to all nodes under suffix:

-- Or --

b. Prepare fortress for OpenLDAP usage:

# This param tells fortress what type of ldap server in use:

# Use value from [Set Hostname Entry]:

# OpenLDAP defaults to this:

# These credentials are used for read/write access to all nodes under suffix:

SECTION 5. Build and deploy directory-fortress-rest

1. Verify the java and maven home env variables are set.

mvn -version

This sample requires Java >= 17 and Maven >= 3 to be setup within the execution env.

2. Load the default security policy for Fortress REST.

mvn install -Dload.file=src/main/resources/FortressRestServerPolicy.xml

3. Optional, load a sample security policy for ARBAC.

mvn install -Dload.file=src/main/resources/FortressRestArbacSamplePolicy.xml

4. Deploy to Tomcat:

a. If using autodeploy feature, verify the Tomcat auto-deploy options are set correctly in the pom.xml file:


b. Now, automatically deploy to tomcat server:

mvn clean tomcat:deploy

c. To automatically redeploy sample app:

mvn clean tomcat:redeploy

d. To manually deploy app to Tomcat:

cp target/fortress-rest-[version].war $TOMCAT_HOME/webapps
  • Where $TOMCAT_HOME points to the execution env.

SECTION 6. Unit Test

Run unit test:

mvn test -Dtest=EmTest

Test Notes:

  • The Fortress Rest application must be deployed and running within your servlet container before the unit tests will complete successfully. If your app server is running on a separate machine, or using port other than 8080, adjust the settings accordingly in src/main/test/java/org/apache/directory/fortress/rest/EmTest.java
  • For learning and troubleshooting, it is recommended that you use an HTTP proxy program, like Axis' tpMon to intercept the HTTP/XML request/responses between Fortress rest client and server.
  • The tests depend on sample security policy being loaded.
  • More on how to test README-TESTING.md.

SECTION 7. Fortress Rest properties

This section describes the properties needed to control fortress rest.

1. LDAP Hostname coordinates.

The host name can be specified as a fully qualified domain name or IP address:

# Host name and port of LDAP DIT:

2. LDAP Server type. Each LDAP server impl

# If ApacheDS server:
# Else if OpenLDAP server:
# Else leave blank:
  • note: has different behavior on operations like password policies and audit. If using a 3rd type of server that isn't formally supported, leave blank or type is other.

3. Set the credentials of service account.

This service account must have read/write privileges over the entire Fortress LDAP Directory Information Tree (DIT):

# If ApacheDS it will look something like this:
# Else If OpenLDAP it will look something like this:

4. Define the number of LDAP connections to use in the pool

# This is min/max settings for LDAP connections.  For testing and low-volume instances this will work:

Notes on connection pools:

  • This setting will be proportional to the number of concurrent users but won't be one-to-one.
  • The number of required ldap connections will be much lower than concurrent users.

5. Give coordinates to the Config node that contains all of the other Fortress properties.

This will match your LDAP‘s server’s config node per Fortress Core setup:

# This node contains fortress properties stored on behalf of connecting LDAP clients:

6. If using LDAPS.

# Used for SSL Connection to LDAP Server:

7. If using ApacheDS and setting password policies, point to the correction location.

# ApacheDS stores its password policies objects here by default: