> [!CAUTION]
> **Caution:** This documentation covers Edge for Private Cloud 4.50.00, which is no longer supported. Google does not provide security patches, bug fixes, or technical support for this version. The current supported version is 4.54.00. See the [Edge for Private Cloud documentation](https://docs.apigee.com/private-cloud/latest/overview) for the current version, or [All versions](https://docs.apigee.com/private-cloud/versions) to compare releases.

This section explains how to obtain, install, and configure the components required to
integrate an LDAP service into Apigee Edge for user authentication.

> [!NOTE]
> **NOTE:** These instructions apply to Microsoft Active Directory. For other LDAP services, please consult their documentation.

## Prerequisites

- You must have an Apigee Edge for Private Cloud 4.18.05 installation.
- You must have global system administrator credentials on Apigee Edge for Private Cloud to perform this installation.
- You need to know the root directory of your Apigee Edge for Private Cloud installation. The default root directory is `/opt`.
- You must add your **Edge global system administrator credentials** to the external LDAP. Remember that by default, the sysadmin credentials are stored in the Edge internal LDAP. Once you switch to the **external** LDAP, your sysadmin credentials will be authenticated there instead. Therefore, you must provision the credentials to the external system **before** enabling external authentication in Edge.

  For example if you have configured and installed Apigee Edge for Private Cloud with global
  system administrator credentials as:

  ```
  username: edgeuser@mydomain.com
  password: Secret123
  ```

  Then the user `edgeuser@mydomain.com` with password
  `Secret123` must also be present in the external LDAP.
- If you are running a Management Server cluster, note that you must perform all of the steps in this document for each Management Server.

## Configuring external authentication

The main activity you'll perform is configuring the `management-server.properties` file.
This activity includes stopping and starting the Edge Management Server, deciding whether you
want to use direct or indirect binding, encrypting sensitive credentials, and other related
tasks.

1. **Important** : Decide now whether you intend to use the indirect or direct binding authentication method. This decision will affect some aspects of the configuration. See [External Authentication](https://docs.apigee.com/private-cloud/v4.50.00/external-authentication-configuration-overview).
2. **Important**: You must do these config steps on each Apigee Edge Management Server (if you are running more than one).
3. Open `/opt/apigee/customer/application/management-server.properties` in a text editor. If the file does not exist, create it.
4. Add the following line:

   ```
   conf_security_authentication.user.store=externalized.authentication
   ```

   > [!NOTE]
   > **Note:** Be sure that there are no trailing spaces at the end of the line.

   This line adds the external authentication feature to your Edge for Private Cloud
   installation.
5. To make this step easy, we have created two well-commented **sample configurations --
   one for direct and one for indirect binding authentication** . See the samples below for the binding you wish to use, and complete the configuration:
   - [DIRECT BINDING configuration sample](https://docs.apigee.com/private-cloud/v4.50.00/enabling-external-authentication#configuringexternalauthentication-directbindingconfigurationsample)
   - [INDIRECT BINDING configuration sample](https://docs.apigee.com/private-cloud/v4.50.00/enabling-external-authentication#configuringexternalauthentication-indirectbindingconfigurationsample)
6. Restart the Management Server:

   ```
   /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
   ```
7. Verify that the server is running:

   ```
   /opt/apigee/apigee-service/bin/apigee-all status
   ```
8. **Important** : You must do an additional configuration under either (or both) of the following circumstances:
   1. If you intend to have users log in using usernames that are not email addresses. In this case, your sysadmin user must also authenticate with a username.<br />

      **AND/OR**
   2. If the password for your sysadmin user account in your external LDAP is different from the password you configured when you first installed Apigee Edge for Private Cloud. See [Configuration required for different sysadmin credentials](https://docs.apigee.com/private-cloud/v4.50.00/additional-configuration-required-event-different-sysadmin-credentials).

### DIRECT BINDING
configuration sample

```
## The first property is always required to enable the external authorization feature.
## Do not change it.
conf_security_externalized.authentication.implementation.class=com.apigee.rbac.impl.LdapAuthenticatorImpl

## Identify the type of binding:
## Set to "true" for direct binding
## Set to "false" for indirect binding.
conf_security_externalized.authentication.bind.direct.type=true

## The next seven properties are needed regardless of direct or indirect binding. You need to
## configure these per your external authentication installation.
## The IP or domain for your external LDAP instance. 
conf_security_externalized.authentication.server.url=ldap://localhost:389

## Your external LDAP server version.
conf_security_externalized.authentication.server.version=3

## The server timeout in milliseconds. 
conf_security_externalized.authentication.server.conn.timeout=50000

## Change these baseDN values to match your external LDAP service. This attribute value will be
## provided by your external LDAP administrator, and may have more or fewer dc elements depending
## on your setup.
conf_security_externalized.authentication.user.store.baseDN=dc=apigee,dc=com

## Do not change this search string. It is used internally. 
conf_security_externalized.authentication.user.store.search.query=(&(${userAttribute}=${userId}))

## Identifies the external LDAP property you want to bind against for Authentication. For
## example if you are binding against an email address in Microsoft Active Directory, this would be
## the userPrincipalName property in your external LDAP instance. Alternatively if you are binding
## against the user's ID, this would typically be in the sAMAccountName property:
conf_security_externalized.authentication.user.store.user.attribute=userPrincipalName

## The LDAP attribute where the user email value is stored. For direct binding with AD, set it to
## userPrincipalName.
conf_security_externalized.authentication.user.store.user.email.attribute=userPrincipalName

## ONLY needed for DIRECT binding.
## The direct.bind.user.directDN property defines the string that is used for the bind against the
## external authentication service. Ensure it is set as follows:
conf_security_externalized.authentication.direct.bind.user.directDN=${userDN}
```

### INDIRECT BINDING configuration sample

```
## Required to enable the external authorization feature. Do not change it.
conf_security_externalized.authentication.implementation.class=com.apigee.rbac.impl.LdapAuthenticatorImpl

## Identifies the type of binding:
## Set to "true" for direct binding
## Set to "false" for indirect binding.
conf_security_externalized.authentication.bind.direct.type=false

## The next seven properties are needed regardless of direct or indirect binding. You need to
## configure these per your external LDAP installation.
## The IP or domain for your external LDAP instance.
conf_security_externalized.authentication.server.url=ldap://localhost:389

## Replace with your external LDAP server version.
conf_security_externalized.authentication.server.version=3

## Set the server timeout in milliseconds. 
conf_security_externalized.authentication.server.conn.timeout=50000

## Change these baseDN values to match your external LDAP service. This attribute value will be
# provided by your external LDAP administrator, and may have more or fewer dc elements
# depending on your setup.
conf_security_externalized.authentication.user.store.baseDN=dc=apigee,dc=com

## Do not change this search string. It is used internally. 
conf_security_externalized.authentication.user.store.search.query=(&(${userAttribute}=${userId}))

## Identifies the external LDAP property you want to bind against for Authentication. For example
## if you are binding against an email address, this would typically be in the
## userPrincipalName property in your external LDAP instance. Alternatively if you are binding
## against the user's ID, this would typically be in the sAMAccountName property.
## See also "https://docs.apigee.com/private-cloud/v4.50.00/additional-configuration-required-event-different-sysadmin-credentials".
conf_security_externalized.authentication.user.store.user.attribute=userPrincipalName

## Used by Apigee to perform the Authorization step and currently, Apigee only supports email
## address for Authorization. Make sure to set it to the attribute in your external LDAP that
## stores the user's email address. Typically this will be in the userPrincipalName property.
conf_security_externalized.authentication.user.store.user.email.attribute=userPrincipalName

## The external LDAP username (for a user with search privileges on the external LDAP) and
## password and whether the password is encrypted. You must also set the attribute
## externalized.authentication.bind.direct.type to false.
## The password attribute can be encrypted or in plain text. See
## "https://docs.apigee.com/private-cloud/v4.50.00/indirect-binding-only-encrypting-external-ldap-user-password"
## for encryption instructions. Set the password.encrypted attribute to "true" if the password is
## encrypted. Set it to "false" if the password is in plain text.
conf_security_externalized.authentication.indirect.bind.server.admin.dn=myExtLdapUsername
conf_security_externalized.authentication.indirect.bind.server.admin.password=myExtLdapPassword
conf_security_externalized.authentication.indirect.bind.server.admin.password.encrypted=true
```

## Testing the installation

1. Verify that the server is running:

   ```
   /opt/apigee/apigee-service/bin/apigee-all status
   ```
2. Execute this command, providing a set of **Apigee Edge global system admin
   credentials** . The API call we're going to test can only be executed by an Edge sysadmin.

   > [!IMPORTANT]
   > **Important**: The identical credentials must exist in your external LDAP account. If not, you need to add them now. Note that the username is usually an email address; however, it depends on how you have configured external authentication, as explained previously in this document.

   ```
   curl -v http://management-server-IP:8080/v1/o -u sysadmin_username
   ```

   For example:

   ```
   curl -v http://192.168.52.100:8080/v1/o -u jdoe@mydomain.com
   ```
3. Enter your password when prompted. If the command returns a 200 status and a list of organizations, the configuration is correct.
   This command verifies that the API call to the Edge Management Server was successfully
   authenticated through the external LDAP system.