Using Identity Store

All

Intro

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

Application

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

Core

Web.xml

 

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”);
ds.startListening();

And to start/stop we can do:

// Disconnect from the server and cause the server to shut down.
conn.close();
ds.shutDown(true);

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:

sonic

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

 

Deployment

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

Accessing

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

References

https://www.digitalocean.com/community/tutorials/how-to-use-ldif-files-to-make-changes-to-an-openldap-system

https://docs.wildfly.org/12/WildFly_Elytron_Security.html

https://docs.ldap.com/ldap-sdk/docs/in-memory-directory-server.html

 

Leave a Reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s