Creating a Custom Directory Connector

Crowd 1.4 Documentation

Index

Crowd comes with a number of supplied directory connectors. If your directory is not listed in Supported Applications and Directories then you will need to create your own custom directory connector.

The page 2.2.3 Configuring a Custom Directory Connector does not exist.

The directory connectors that come with Crowd implement the Java interface RemoteDirectory. The RemoteDirectory interface defines generic methods for authentication, searching and entity create, remove and update operations.

To connect Crowd to a custom directory server, you will need to write a Java class file that implements the RemoteDirectory interface.

In our example below, the MyCustomDirectoryServer class extends the Crowd DirectoryEntity utility class. The utility class manages setting runtime properties that may be used by the Crowd server in the future for operations such as getting the Crowd ID number of the directory server.

package com.atlassian.crowd.integration.directory.custom;

import com.atlassian.crowd.integration.SearchContext;
import com.atlassian.crowd.integration.authentication.PasswordCredential;
import com.atlassian.crowd.integration.directory.RemoteDirectory;
import com.atlassian.crowd.integration.exception.*;
import com.atlassian.crowd.integration.model.DirectoryEntity;
import com.atlassian.crowd.integration.model.RemoteGroup;
import com.atlassian.crowd.integration.model.RemotePrincipal;
import com.atlassian.crowd.integration.model.RemoteRole;

import java.rmi.RemoteException;
import java.util.List;

public class MyCustomDirectoryServer extends DirectoryEntity implements RemoteDirectory
{
    public RemotePrincipal authenticate(String name, PasswordCredential[] credentials) throws RemoteException, 
            InvalidPrincipalException, InactiveAccountException, InvalidAuthenticationException {
        // Perform your custom directory server authentication code here.
        // 
        // The source code to the InternalDirectory, which comes with your commercial license is a good implementation example.
    }

    // Other RemoteDirectory interface methods will also need to be implemented ...
}

Once you have finished implementing all of the methods defined by the RemoteDirectory interface, you will then need to:

  1. Create a JAR of the MyCustomDirectoryServer and any supporting class files.
  2. Shut down Crowd.
  3. Place the newly-created JAR from step one in the CROWD/crowd-webapp/WEB-INF/lib folder.
  4. Start Crowd.
  5. Follow the instructions on configuring a custom directory connector through the Crowd Administration Console.
A 'principal' is a 'user'

In Crowd, the term 'principal' is equivalent to the term 'user'. In Crowd 1.3.0 and later, the Crowd Administration Console uses the term 'user'. Earlier versions of Crowd, and also certain API libraries, use the term 'principal'.

Next Steps

After creating your directory connector, please see Configuring a Custom Directory Connector.

Related Topics

Crowd Documentation

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 20

    Timo says:

    FYI there are a few things to be aware of if developing a custom Directory for C...

    FYI – there are a few things to be aware of if developing a custom Directory for Crowd v1.4.3.

    1) Custom directories do not get the Connector nor Configuration tabs – so you'll have to set attributes manually
    2) Extending DelegatedDirectory requires a small workaround

    More details in this forum thread: http://forums.atlassian.com/thread.jspa?messageID=257282866

    Cheers,
    Tim

Add Comment