Rate this page:
Custom directory connectors allow you to connect Crowd to custom user-stores, such as existing databases or legacy systems. 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 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.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
package com.example;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import com.atlassian.crowd.directory.RemoteDirectory;
import com.atlassian.crowd.embedded.api.PasswordCredential;
import com.atlassian.crowd.exception.*;
import com.atlassian.crowd.model.group.Group;
import com.atlassian.crowd.model.group.GroupTemplate;
import com.atlassian.crowd.model.group.GroupWithAttributes;
import com.atlassian.crowd.model.group.Membership;
import com.atlassian.crowd.model.user.User;
import com.atlassian.crowd.model.user.UserTemplate;
import com.atlassian.crowd.model.user.UserWithAttributes;
import com.atlassian.crowd.search.query.entity.EntityQuery;
import com.atlassian.crowd.search.query.membership.MembershipQuery;
public class MyCustomDirectory implements RemoteDirectory
{
@Override
public User authenticate(String name, PasswordCredential passwordCredential)
throws UserNotFoundException, InactiveAccountException, InvalidAuthenticationException, ExpiredCredentialException, OperationFailedException
{
throw new RuntimeException("Not implemented"); // replace with your own implementation
}
// Other RemoteDirectory interface methods will also need to be implemented ...
}
To compile your class, add a dependency on the com.atlassian.crowd:crowd-api
Maven artifact. Using Maven is recommended because that artifact will pull all the transitive dependencies, like crowd-integration-api
and others.
Once you have finished implementing all of the methods defined by the RemoteDirectory
interface, you will then need to:
MyCustomDirectory
and any supporting class files.CROWD/crowd-webapp/WEB-INF/lib
folder.After creating your directory connector, please see Configuring a Custom Directory Connector.
Rate this page: