Using Identity Store



Was searching here on a small application for deploying in JBoss using ​​Ldap, which is a protocol for managing with services directories.

So, the basic requirement is: An application that has a Ldap custom module for log in.

The ldapwiki helps a lot actually


The process is partially described here, ie, we want to have inMemoryDirectoryServer this basically starts, stop, and manipulate in general the Ldap configuration. To set all the information on the Server, we use a InMemoryDirectoryServerConfig

InMemoryDirectoryServer: start, stop, manipulate

InMemoryListenerConfig: loads  the configuration file




Application Config

InMemoryDirectoryServerConfig config =
new InMemoryDirectoryServerConfig(“dc=example,dc=com”);
config.addAdditionalBindCredentials(“cn=Directory Manager”, “password”);

// Create the directory server instance, populate it with data from the
// “test-data.ldif” file, and start listening for client connections.
InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
ds.importFromLDIF(true, “app.ldif”);

And to start/stop we can do:

// Disconnect from the server and cause the server to shut down.

When you login, you will see:

<h:outputText value=”Hello World”/>
<!– added sonic the hedgehog –>
<img src=”img/sonic.jpg” alt=”Sonic”></img>

So this:


user.ldif  ~ LDAP Data Interchange Format

We use a ldif file so we can set the users that will access the application, as explained on the link, this file is a bit tricky and has its own.

dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People

Compilation with Maven



INFO [stdout] (ServerService Thread Pool — 82) —Starting App


The access is done throw http://localhost:8080/app-test/user



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s