
Lightweight Directory Access Protocol (LDAP) is an application for working with various directory services. It allows you to store, query, and alter information in a centralized directory, making it a popular choice for authentication and authorization systems.

In this blog, we will walk through LDAP authentication and creating Organizational Units, groups, and users in an LDAP directory.
Prerequisite:
- You have already configured your LDAP Server.
- And,
Apache Directory Studio
is already installed on your machine.
- And,
LDAP Authentication
LDAP authentication involves checking a user’s credentials against the information stored in an LDAP directory to verify their identity.

LDAP Authentication with Active Directory
LDAP authentication involves the following steps:
- First, the user enters their LDAP credentials into a login form.
- The application sends an LDAP query to the directory server, such as the Active directory, to retrieve the user’s record through API Gateway.
- The server checks the user’s credentials and returns a response to the application.
- If the user-provided credentials are valid, the application grants access to the user.
- Read more about: How to install CDK CLI?
You must first set up an LDAP server and set up your application to use it for authentication before you can use it. This usually entails giving the server’s hostname, port number, LDAP search base, and credentials for directory access.
LDAP directories are organized in a tree structure:
- guides is a tree of directory entries.
- An entry contains a set of attributes.
- An attribute has a name and one or more values.
Creating OUs, Groups, and Users
Once you have set up an LDAP server and connected your LDAP server, you can begin creating Organizational Units, groups, and users to organize and manage your directory information.
Read also: Host static website on AWS S3.
Organizational Units are containers for grouping related objects within an LDAP directory. They can organize users, groups, and other resources by department, location, or other criteria.
To create an OU, you can use an LDAP client tool such as ldapmodify
or Apache Directory Studio
to issue the server’s LDIF (LDAP Data Interchange Format) command. In this blog, we are using Apache Directory Studio
. The following LDIF command creates an OU named “Gitlab” within the “Gitlab.com” domain:

OU
on Apache Directory StudioCreating OU
on Apache Directory Studio
Groups are collections of users that can be utilized within an application to provide rights or roles. To construct a group, use an LDIF command similar to the one above but with the groupOfNames objectClass instead of Organization Unit. The following LDIF command, for example, establishes a group named security within the group’s OU:

Users are individual entries in an LDAP directory representing people or other entities. You can create a user with an LDIF command and the inetOrgPerson objectClass, which includes properties like name and password. The following LDIF command, for example, creates a user named. ldap
:

The overall Directory Information Tree (DIT) would be like this:

Used Terms:
- dc: domain components
- o: organization name
- ou: organization unit
- cn: common name
- sn: surname
- Dn: distinguish the name
- user: inetOrgPerson/groupsOfUniqueName [Collectively forms an object]
Conclusion:
LDAP is a powerful protocol that is used to talk with directory services like Active Directory
. In this blog, we will go over the foundations of LDAP authentication. How to build OUs, groups, and set up LDAP active directories users to help you manage your organization’s directory services and increase security and access control.