Showing posts with label ldap. Show all posts
Showing posts with label ldap. Show all posts

Sunday, March 21, 2010

Time for some screencasts

Inspired by awesome work that Wesley Hales is doing in the JBoss Portlet Community I recently decided to try doing screencasts myself. Today I would like to share my first attempts with you. Movies below cover GateIn Portal integration with LDAP and give some insight about internal Picketlink IDM usage. First one demonstrates how you can start experimenting with sample configuration in few simple steps and uses OpenDS as an example server. Second one separately shows Active Directory integration as it requires few special config tweaks and includes MSAD installation instructions (in Part 1).









Both screencasts are based on tutorials that can be found in GateIn wiki:
- http://community.jboss.org/wiki/GateInwithLDAPasadefaultuserandgroupstore
- http://community.jboss.org/wiki/GateInwithLDAPinreadonlymode

So far my experience is that.... doing screencasts is way more challenging and time consuming than it seems :)

I hope to get some feedback from you (and I'm already aware about few things that I could have done better...)

P.S. Big thanks to Wesley for sharing his screencast experience

Tuesday, July 29, 2008

Embedded OpenDS 1.0.0

I was recently playing with OpenDS LDAP server 1.0.0. As its pure Java implementation it is used in embedded mode in JBoss AS and JBoss Portal testsuites. What is so cool about embedded OpenDS and why you should look at it?
  • It requires only two jar files for basic features support
  • Just few lines of code for management operations are needed.
  • Community on the mailing lists is very responsive
There are few good resources describing how to embed OpenDS available on the web:
However as the project evolves rapidly they don't cover the most recent 1.0.0 version. Here are few simple steps needed to bootstrap OpenDS from Java code:

  1. Download OpenDS 1.0.0 and unzip it.
  2. Fire the 'setup' config script from the main directory and alter the configuration as you need. Remember to shutdown the server if you let to start it.
  3. Embedded OpenDS will require a special directory structure to be able to start. All needed files can be copied from the server directory and are shown on the picture below:

    The 'db' directory can be left empty if you want to add the root entry manually in the code

  4. Copy OpenDS.jar and je.jar files from OpenDS-1.0.0/lib/ directory and add them to the project classpath
  5. Edit opends/config/config.ldif and remove following entry:

    dn: cn=SNMP Connection Handler,cn=Connection Handlers,cn=config
    objectClass: top
    objectClass: ds-cfg-snmp-connection-handler
    objectClass: ds-cfg-connection-handler
    ds-cfg-listen-port: 161
    ds-cfg-enabled: false
    ds-cfg-trap-port: 162
    ds-cfg-java-class: org.opends.server.snmp.SNMPConnectionHandler
    cn: SNMP Connection Handler


    (This entry requires to have OpenDS-1.0.0/lib/extensions/snmp-mib2605.jar file on the classpath)
Now with such prepared directory structure OpenDS can be started directly from the Java code. Belpw there is a very simple class that manages server lifecycle - it just needs two jar files in the classpath (OpenDS.jar and je.jar)




public class OpenDSService
{
private String serverRoot = "";

public DirectoryEnvironmentConfig getConfig()
{
DirectoryEnvironmentConfig config = new DirectoryEnvironmentConfig();

try
{

// Server root points to the directory with opends configuration
config.setServerRoot(new File(getServerRoot()));
config.setForceDaemonThreads(true);

}
catch (InitializationException e)
{
e.printStackTrace();
}

return config;
}


public void start()
{
if (!EmbeddedUtils.isRunning())
{
try
{
EmbeddedUtils.startServer(getConfig());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

public void stop()
{
if (EmbeddedUtils.isRunning())
{
EmbeddedUtils.stopServer(this.getClass().getName(), null);
}
}

public String getServerRoot()
{
return serverRoot;
}

public void setServerRoot(String serverRoot)
{
this.serverRoot = serverRoot;
}
}





Here there is a trivial example maven project that starts opends and performs simple JNDI search.