com.atlassian.crowd.integration.directory.connector
Class LDAPDirectory

java.lang.Object
  extended by com.atlassian.crowd.integration.directory.connector.LDAPDirectory
All Implemented Interfaces:
RemoteDirectory
Direct Known Subclasses:
AppleOpenDirectory, MicrosoftActiveDirectory, SunONE

public abstract class LDAPDirectory
extends Object
implements RemoteDirectory

Geneirc LDAP connector.

Version:
1.0
Author:
Justen Stepka

Field Summary
protected  Map attributes
          Attributes for the entity.
static String CONNECTION_FACTORY
          LDAP connection factory.
static String CONNECTION_FACTORY_SSL_IMPL
          LDAP secure connection factory.
static String CONNECTION_INITIAL_CONTEXT_FACTORY
          LDAP initial context factory.
static String CONNECTION_SECURITY_AUTHENTICATION
          LDAP connection method.
static String CONNECTION_SSL_SECURITY_PROTOCOL
          LDAP secure connection method.
protected static int DEFAULT_PAGE_SIZE
          Default directory paging size, active directory will return a max of 1000 entities.
protected static String DISTINGUISHED_NAME
          The distringuished name attribute: distinguishedname.
static String GROUP_DESCRIPTION_KEY
          Attribute key for the LDAP group description attribute.
static String GROUP_DN_ADDITION
          Attribute key for the LDAP group base dn.
static String GROUP_NAME_KEY
          Attribute key for the LDAP group name attribute.
static String GROUP_OBJECTCLASS_KEY
          Attribute key for the LDAP group object class.
static String GROUP_USERNAMES_KEY
          Attribute key for the LDAP group membership attribute.
static String LDAP_BASEDN_KEY
          Attribute key for the LDAP base DN.
protected static String LDAP_OBJECTCLASS
          Object type to key off when searching a tree.
static String LDAP_PASSWORD_KEY
          Attribute key for the LDAP password.
static String LDAP_SECURE_KEY
          Attribute key for the SSL required flag..
static String LDAP_URL_KEY
          Attribute key for the LDAP url.
static String LDAP_USERDN_KEY
          Attribute key for the LDAP user DN.
protected static String NAME
          Generic LDAP connector name.
protected static String PRINCIPAL_NO_VALID_PASSWORD
          Exception message when unable to process a supplied password credential.
static String ROLE_DESCRIPTION_KEY
          Attribute key for the LDAP role description attribute.
static String ROLE_DN_ADDITION
          Attribute key for the LDAP role base dn.
static String ROLE_NAME_KEY
          Attribute key for the LDAP role name attribute.
static String ROLE_OBJECTCLASS_KEY
          Attribute key for the LDAP role object class.
static String ROLE_USERNAMES_KEY
          Attribute key for the LDAP role membership attribute.
protected static String UNABLE_TO_CONNECT
          Exception message when unable to connect to the directory server.
static String USER_DN_ADDITION
          Attribute key for the LDAP principal base dn.
static String USER_EMAIL_KEY
          Attribute key for the LDAP principal email attribute.
static String USER_FIRSTNAME_KEY
          Attribute key for the LDAP principal lastname attribute.
static String USER_GROUP_KEY
          Attribute key for the LDAP principal memberships attribute.
static String USER_LASTNAME_KEY
          Attribute key for the LDAP principal firstname attribute.
static String USER_OBJECTCLASS_KEY
          Attribute key for the LDAP principal object class.
static String USER_PASSWORD_KEY
          Attribute key for the LDAP principal password attribute.
static String USER_USERNAME_KEY
          Attribute key for the LDAP principal name attribute.
 
Fields inherited from interface com.atlassian.crowd.integration.directory.RemoteDirectory
DIRECTORY_TYPE
 
Constructor Summary
LDAPDirectory()
           
 
Method Summary
protected  void addContainerEntity(LdapContext connection, String objectClass, String dnAdditionKey, String entityNameKey, String entityDescriptionKey, String entityMemberKey, String name, String description, Set members)
          Adds a container object to the LDAP tree.
 RemoteGroup addGroup(RemoteGroup group)
          Adds a group to the directory store.
protected  void addMemberToContainerEntity(LdapContext connection, String objectClass, String dnAddition, String nameKey, String memberKey, String containername, String membername)
          Adds a member to container entity.
protected  Attributes addPrincipalGeneric(RemotePrincipal principal)
          Translates a principal into LDAP attributes.
 void addPrincipalToGroup(String name, String group)
          Adds a principal to a group.
 void addPrincipalToRole(String name, String role)
          Adds a principal to a role.
 RemoteRole addRole(RemoteRole role)
          Adds a role to the directory store.
 RemotePrincipal authenticate(String name, PasswordCredential[] credentials)
          Authenticates a principal verses the directory store.
protected  String buildBaseDN(String entityKeyType)
          Builds a base DN for search filters.
protected  String buildEntityDN(LdapContext connection, String objectClass, String dnAddition, String nameKey, String name)
          Builds the entity DN for a given object type.
protected  StringBuffer buildSearch(String attribute, String value, boolean wildcard)
          Builds a search filter restriction filter.
protected  StringBuffer buildSearchObject(String objectClass)
          Builds the base search filter for searching an LDAP tree.
protected  LdapContext connect()
          Establishes a connection to the LDAP server.
protected  void disconnect(LdapContext context)
          Disconnects from the LDAP server.
 RemoteGroup findGroupByName(String name)
          Finds the group that matches the supplied name.
 List findGroupMemberships(String principalName)
          Returns a list of group names that a principal is a member of.
 RemotePrincipal findPrincipalByName(String username)
          Finds the principal that matches the supplied name.
 RemoteRole findRoleByName(String name)
          Finds the role that matches the supplied name.
 List findRoleMemberships(String principalName)
          Returns a list of role names that a principal is a member of.
 AttributeValues getAttribute(String key)
          Gets an attribute by name for the directory server.
 Map getAttributes()
          Sets the attributes of the entity.
static Map getConfigurationDetails()
          Returns a map of the LDAP names as the keys and the properties associated with that LDAP connector.
 long getID()
          Gets the internal unique ID of the directory store.
static Map getImplementations()
          Returns a map of the LDAP names as the keys and the implementation class as Strings.
protected  String getSingleAttribute(String key)
          Sets a single attribute by name for the directory server.
 boolean isGroupMember(String group, String principal)
          Checks if a principal is a member of a group.
protected  boolean isMemeber(LdapContext connection, String objectClass, String dnAddition, String nameKey, String membersKey, String group, String principal)
          Checks if a principal is a member of a LDAP container object.
 boolean isRoleMember(String role, String username)
          Checks if a principal is a member of a role.
protected  boolean isSecureSSL()
          If the connection must be secure.
protected static byte[] parseControlResponse(Control[] controls)
          Processes any controls to resulting from a directory query.
protected  List populateAttribute(Attribute ldapAttribute)
          Translates LDAP attributes into a list of Strings.
protected  Map populateAttributes(Attributes ldapAttributes)
          Translates LDAP attributes into a map of values.
protected  RemoteGroup populateGroup(LdapContext connection, Attributes attributes, boolean processMembers)
          Populates a group using directory server attributes.
protected  RemotePrincipal populatePrincipal(LdapContext connection, Attributes attributes, boolean processAttributes)
          Populates a principal using directory server attributes.
protected  RemoteRole populateRole(LdapContext connection, Attributes attributes, boolean processMembers)
          Populates a role using directory server attributes.
protected  Set processMembers(LdapContext connection, Attributes attributes)
          Processes the members of an LDAP container object.
 void removeGroup(String name)
          Removes the role that matches the supplied name.
protected  void removeMemberFromContainerEntity(LdapContext connection, String objectClass, String dnAddition, String nameKey, String memberKey, String containername, String membername)
          Removes a member from a container object.
 void removePrincipal(String name)
          Removes the principal that matches the supplied name.
 void removePrincipalFromGroup(String name, String unsubscribedGroup)
          Removes a principal from a group.
 void removePrincipalFromRole(String name, String removeRole)
          Removes a principal from a role.
 void removeRole(String name)
          Removes the group that matches the supplied name.
 List searchGroups(SearchContext searchContext)
          Searches for all principals who match the supplied search criteria.
 List searchPrincipals(SearchContext searchContext)
          Search for all principals who match the supplied search criteria.
 List searchRoles(SearchContext searchContext)
          Search for all roles who match the supplied search criteria.
 void setAttribute(String key, AttributeValues values)
          Sets multiple attributes by name for the directory server.
 void setAttribute(String key, String value)
          Sets a single attribute by name for the directory server.
 void setAttributes(Map attributes)
          Gets the attributes of the entity.
 void setID(long ID)
          When a directory store is loaded, the ID will be set by the crowd framework.
 void testConnection()
          Test if a connection to the directory server can be established.
 RemoteGroup updateGroup(RemoteGroup group)
          Updates the group by the name attribute.
 RemotePrincipal updatePrincipal(RemotePrincipal principal)
          Updates the principal by the name attribute.
 RemoteRole updateRole(RemoteRole role)
          Updates the role by the name attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.crowd.integration.directory.RemoteDirectory
addPrincipal, getDirectoryType, updatePrincipalCredential
 

Field Detail

NAME

protected static final String NAME
Generic LDAP connector name.

See Also:
Constant Field Values

UNABLE_TO_CONNECT

protected static final String UNABLE_TO_CONNECT
Exception message when unable to connect to the directory server.

See Also:
Constant Field Values

PRINCIPAL_NO_VALID_PASSWORD

protected static final String PRINCIPAL_NO_VALID_PASSWORD
Exception message when unable to process a supplied password credential.

See Also:
Constant Field Values

CONNECTION_INITIAL_CONTEXT_FACTORY

public static String CONNECTION_INITIAL_CONTEXT_FACTORY
LDAP initial context factory.


CONNECTION_SECURITY_AUTHENTICATION

public static String CONNECTION_SECURITY_AUTHENTICATION
LDAP connection method.


CONNECTION_SSL_SECURITY_PROTOCOL

public static String CONNECTION_SSL_SECURITY_PROTOCOL
LDAP secure connection method.


CONNECTION_FACTORY

public static String CONNECTION_FACTORY
LDAP connection factory.


CONNECTION_FACTORY_SSL_IMPL

public static String CONNECTION_FACTORY_SSL_IMPL
LDAP secure connection factory.


attributes

protected Map attributes
Attributes for the entity.


LDAP_URL_KEY

public static final String LDAP_URL_KEY
Attribute key for the LDAP url.

See Also:
Constant Field Values

LDAP_SECURE_KEY

public static final String LDAP_SECURE_KEY
Attribute key for the SSL required flag..

See Also:
Constant Field Values

LDAP_BASEDN_KEY

public static final String LDAP_BASEDN_KEY
Attribute key for the LDAP base DN.

See Also:
Constant Field Values

LDAP_USERDN_KEY

public static final String LDAP_USERDN_KEY
Attribute key for the LDAP user DN.

See Also:
Constant Field Values

LDAP_PASSWORD_KEY

public static final String LDAP_PASSWORD_KEY
Attribute key for the LDAP password.

See Also:
Constant Field Values

GROUP_DN_ADDITION

public static final String GROUP_DN_ADDITION
Attribute key for the LDAP group base dn.

See Also:
Constant Field Values

GROUP_DESCRIPTION_KEY

public static final String GROUP_DESCRIPTION_KEY
Attribute key for the LDAP group description attribute.

See Also:
Constant Field Values

GROUP_NAME_KEY

public static final String GROUP_NAME_KEY
Attribute key for the LDAP group name attribute.

See Also:
Constant Field Values

GROUP_OBJECTCLASS_KEY

public static final String GROUP_OBJECTCLASS_KEY
Attribute key for the LDAP group object class.

See Also:
Constant Field Values

GROUP_USERNAMES_KEY

public static final String GROUP_USERNAMES_KEY
Attribute key for the LDAP group membership attribute.

See Also:
Constant Field Values

ROLE_DN_ADDITION

public static final String ROLE_DN_ADDITION
Attribute key for the LDAP role base dn.

See Also:
Constant Field Values

ROLE_DESCRIPTION_KEY

public static final String ROLE_DESCRIPTION_KEY
Attribute key for the LDAP role description attribute.

See Also:
Constant Field Values

ROLE_NAME_KEY

public static final String ROLE_NAME_KEY
Attribute key for the LDAP role name attribute.

See Also:
Constant Field Values

ROLE_OBJECTCLASS_KEY

public static final String ROLE_OBJECTCLASS_KEY
Attribute key for the LDAP role object class.

See Also:
Constant Field Values

ROLE_USERNAMES_KEY

public static final String ROLE_USERNAMES_KEY
Attribute key for the LDAP role membership attribute.

See Also:
Constant Field Values

USER_DN_ADDITION

public static final String USER_DN_ADDITION
Attribute key for the LDAP principal base dn.

See Also:
Constant Field Values

USER_EMAIL_KEY

public static final String USER_EMAIL_KEY
Attribute key for the LDAP principal email attribute.

See Also:
Constant Field Values

USER_FIRSTNAME_KEY

public static final String USER_FIRSTNAME_KEY
Attribute key for the LDAP principal lastname attribute.

See Also:
Constant Field Values

USER_GROUP_KEY

public static final String USER_GROUP_KEY
Attribute key for the LDAP principal memberships attribute.

See Also:
Constant Field Values

USER_LASTNAME_KEY

public static final String USER_LASTNAME_KEY
Attribute key for the LDAP principal firstname attribute.

See Also:
Constant Field Values

USER_OBJECTCLASS_KEY

public static final String USER_OBJECTCLASS_KEY
Attribute key for the LDAP principal object class.

See Also:
Constant Field Values

USER_USERNAME_KEY

public static final String USER_USERNAME_KEY
Attribute key for the LDAP principal name attribute.

See Also:
Constant Field Values

USER_PASSWORD_KEY

public static final String USER_PASSWORD_KEY
Attribute key for the LDAP principal password attribute.

See Also:
Constant Field Values

DEFAULT_PAGE_SIZE

protected static int DEFAULT_PAGE_SIZE
Default directory paging size, active directory will return a max of 1000 entities.


LDAP_OBJECTCLASS

protected static String LDAP_OBJECTCLASS
Object type to key off when searching a tree.


DISTINGUISHED_NAME

protected static String DISTINGUISHED_NAME
The distringuished name attribute: distinguishedname.

Constructor Detail

LDAPDirectory

public LDAPDirectory()
Method Detail

getID

public long getID()
Description copied from interface: RemoteDirectory
Gets the internal unique ID of the directory store.

Specified by:
getID in interface RemoteDirectory
Returns:
The ID.

setID

public void setID(long ID)
Description copied from interface: RemoteDirectory
When a directory store is loaded, the ID will be set by the crowd framework.

Specified by:
setID in interface RemoteDirectory
Parameters:
ID - The ID.

getImplementations

public static Map getImplementations()
Returns a map of the LDAP names as the keys and the implementation class as Strings.

Returns:
The implementations.

getConfigurationDetails

public static Map getConfigurationDetails()
Returns a map of the LDAP names as the keys and the properties associated with that LDAP connector.

Returns:
The configuration details.

getAttributes

public Map getAttributes()
Sets the attributes of the entity.

Specified by:
getAttributes in interface RemoteDirectory
Returns:
The attributes.

setAttributes

public void setAttributes(Map attributes)
Gets the attributes of the entity.

Specified by:
setAttributes in interface RemoteDirectory
Parameters:
attributes - The attributes.

getAttribute

public AttributeValues getAttribute(String key)
Gets an attribute by name for the directory server.

Parameters:
key - They key.
Returns:
The attribute values.

getSingleAttribute

protected String getSingleAttribute(String key)
Sets a single attribute by name for the directory server.

Parameters:
key - The key.
Returns:
The value.

setAttribute

public void setAttribute(String key,
                         String value)
Sets a single attribute by name for the directory server.

Parameters:
key - They key.
value - The value.

setAttribute

public void setAttribute(String key,
                         AttributeValues values)
Sets multiple attributes by name for the directory server.

Parameters:
key - The key.
values - They values.

isSecureSSL

protected boolean isSecureSSL()
If the connection must be secure.

Returns:
true if and only if the connection must be securem, otherwise false.

connect

protected LdapContext connect()
                       throws RemoteException
Establishes a connection to the LDAP server.

Returns:
The LDAP connection.
Throws:
RemoteException - A remote exception occured while trying to connect to the LDAP server.

disconnect

protected void disconnect(LdapContext context)
Disconnects from the LDAP server.

Parameters:
context - The LDAP connection.

parseControlResponse

protected static byte[] parseControlResponse(Control[] controls)
Processes any controls to resulting from a directory query.

Parameters:
controls - The directory controls to process.
Returns:
The the server-generated cookie.

buildSearchObject

protected StringBuffer buildSearchObject(String objectClass)
Builds the base search filter for searching an LDAP tree.

Parameters:
objectClass - The LDAP object class type.
Returns:
The filter.

buildSearch

protected StringBuffer buildSearch(String attribute,
                                   String value,
                                   boolean wildcard)
Builds a search filter restriction filter.

Parameters:
attribute - The object attribute.
value - The object value.
wildcard - If the object value should be a wildcard.
Returns:
The filter.

populateGroup

protected RemoteGroup populateGroup(LdapContext connection,
                                    Attributes attributes,
                                    boolean processMembers)
                             throws NamingException
Populates a group using directory server attributes.

Parameters:
connection - LDAP connection.
attributes - LDAP attributes.
processMembers - true if and only if the members should be popluated, otherwise false.
Returns:
The populated group.
Throws:
NamingException - An LDAP name exception occured.

populateRole

protected RemoteRole populateRole(LdapContext connection,
                                  Attributes attributes,
                                  boolean processMembers)
                           throws NamingException
Populates a role using directory server attributes.

Parameters:
connection - LDAP connection.
attributes - LDAP attributes.
processMembers - true if and only if the members should be popluated, otherwise false.
Returns:
The populated role.
Throws:
NamingException - An LDAP name exception occured.

processMembers

protected Set processMembers(LdapContext connection,
                             Attributes attributes)
                      throws NamingException
Processes the members of an LDAP container object.

Parameters:
connection - LDAP connection.
attributes - LDAP attributes.
Returns:
The populates principals.
Throws:
NamingException - An LDAP name exception occured.

populatePrincipal

protected RemotePrincipal populatePrincipal(LdapContext connection,
                                            Attributes attributes,
                                            boolean processAttributes)
                                     throws NamingException
Populates a principal using directory server attributes.

Parameters:
connection - LDAP connection.
attributes - LDAP attribute.
processAttributes - true if and only if the members attributes should be popluated, otherwise false.
Returns:
The populated principal.
Throws:
NamingException - An LDAP name exception occured.

populateAttributes

protected Map populateAttributes(Attributes ldapAttributes)
                          throws NamingException
Translates LDAP attributes into a map of values.

Parameters:
ldapAttributes - LDAP attributes.
Returns:
values.
Throws:
NamingException - An LDAP name exception occured.

populateAttribute

protected List populateAttribute(Attribute ldapAttribute)
                          throws NamingException
Translates LDAP attributes into a list of Strings.

Parameters:
ldapAttribute - LDAP attribute.
Returns:
List of Strings.
Throws:
NamingException - An LDAP name exception occured.

buildBaseDN

protected String buildBaseDN(String entityKeyType)
Builds a base DN for search filters.

Parameters:
entityKeyType - The object entity type.
Returns:
The base DN filter.

buildEntityDN

protected String buildEntityDN(LdapContext connection,
                               String objectClass,
                               String dnAddition,
                               String nameKey,
                               String name)
                        throws NamingException,
                               ObjectNotFoundException
Builds the entity DN for a given object type.

Parameters:
connection - LDAP connection.
objectClass - LDAP object type.
dnAddition - Any DN addition that might be necessary to the base DN.
nameKey - Restriction attribute, ie name.
name - Restriction value, ie johndoe.
Returns:
The entity DN.
Throws:
NamingException - An LDAP name exception occured.
ObjectNotFoundException - Entity does not exist.

isMemeber

protected boolean isMemeber(LdapContext connection,
                            String objectClass,
                            String dnAddition,
                            String nameKey,
                            String membersKey,
                            String group,
                            String principal)
                     throws NamingException
Checks if a principal is a member of a LDAP container object.

Parameters:
connection - LDAP connection.
objectClass - LDAP object class.
dnAddition - Any DN addition that might be necessary to the base DN.
nameKey - LDAP object class name key.
membersKey - LDAP object class members key.
group - LDAP container name.
principal - LDAP member name.
Returns:
true if and only if the princpial is a member, otherwise false.
Throws:
NamingException - An LDAP name exception occured.

addContainerEntity

protected void addContainerEntity(LdapContext connection,
                                  String objectClass,
                                  String dnAdditionKey,
                                  String entityNameKey,
                                  String entityDescriptionKey,
                                  String entityMemberKey,
                                  String name,
                                  String description,
                                  Set members)
                           throws NamingException,
                                  ObjectNotFoundException
Adds a container object to the LDAP tree.

Parameters:
connection - LDAP connection.
objectClass - LDAP object type.
dnAdditionKey - Base DN location addition.
entityNameKey - Entity name attribute.
entityDescriptionKey - Entity description attribute.
entityMemberKey - Entity members key attribute.
name - Entity name.
description - Entity description.
members - Entity members.
Throws:
NamingException - An LDAP name exception occured.
ObjectNotFoundException - Unable to add the principal to the container.

removeMemberFromContainerEntity

protected void removeMemberFromContainerEntity(LdapContext connection,
                                               String objectClass,
                                               String dnAddition,
                                               String nameKey,
                                               String memberKey,
                                               String containername,
                                               String membername)
                                        throws NamingException,
                                               RemoteException
Removes a member from a container object.

Parameters:
connection - LDAP connection.
objectClass - LDAP object.
dnAddition - Base DN location addition.
nameKey - Entity name attribute.
memberKey - Entity member attribute.
containername - Container name.
membername - Member name.
Throws:
NamingException - An LDAP name exception occured.
RemoteException - Unable to remove the member.

addMemberToContainerEntity

protected void addMemberToContainerEntity(LdapContext connection,
                                          String objectClass,
                                          String dnAddition,
                                          String nameKey,
                                          String memberKey,
                                          String containername,
                                          String membername)
                                   throws NamingException,
                                          RemoteException
Adds a member to container entity.

Parameters:
connection - LDAP connection.
objectClass - LDAP object.
dnAddition - Base DN location addition.
nameKey - Entity name attribute.
memberKey - Entity member attribute.
containername - Container name.
membername - Member name.
Throws:
NamingException - An LDAP name exception occured.
RemoteException - Unable to remove the member.

addPrincipalGeneric

protected Attributes addPrincipalGeneric(RemotePrincipal principal)
Translates a principal into LDAP attributes.

Parameters:
principal - The principal.
Returns:
The LDAP attributes.

addGroup

public RemoteGroup addGroup(RemoteGroup group)
                     throws InvalidGroupException,
                            RemoteException
Description copied from interface: RemoteDirectory
Adds a group to the directory store.

Specified by:
addGroup in interface RemoteDirectory
Parameters:
group - The group to add.
Returns:
The group with any updated attributes.
Throws:
InvalidGroupException - The supplied group is invalid.
RemoteException - An unknown remote exception occured.

addPrincipalToGroup

public void addPrincipalToGroup(String name,
                                String group)
                         throws RemoteException
Description copied from interface: RemoteDirectory
Adds a principal to a group.

Specified by:
addPrincipalToGroup in interface RemoteDirectory
Parameters:
name - The name of the principal.
group - The name of the group.
Throws:
RemoteException - An unknown wire exception occured.

addPrincipalToRole

public void addPrincipalToRole(String name,
                               String role)
                        throws RemoteException
Description copied from interface: RemoteDirectory
Adds a principal to a role.

Specified by:
addPrincipalToRole in interface RemoteDirectory
Parameters:
name - The name of the principal.
role - The name of the role.
Throws:
RemoteException - An unknown wire exception occured.

addRole

public RemoteRole addRole(RemoteRole role)
                   throws InvalidRoleException,
                          RemoteException
Description copied from interface: RemoteDirectory
Adds a role to the directory store.

Specified by:
addRole in interface RemoteDirectory
Parameters:
role - The role to add.
Returns:
The role with any updated attributes.
Throws:
InvalidRoleException - The supplied role is invalid.
RemoteException - An unknown remote exception occured.

authenticate

public RemotePrincipal authenticate(String name,
                                    PasswordCredential[] credentials)
                             throws RemoteException,
                                    InvalidPrincipalException,
                                    InactiveAccountException,
                                    InvalidAuthenticationException
Description copied from interface: RemoteDirectory
Authenticates a principal verses the directory store.

Specified by:
authenticate in interface RemoteDirectory
Parameters:
name - The name of the principal.
credentials - The supplied credentials.
Returns:
The populated principal if the authentication is valid.
Throws:
RemoteException - An unknown remote exception occured.
InvalidPrincipalException - The supplied principal is invalid.
InactiveAccountException - The supplied principal is inactive.
InvalidAuthenticationException - The supplied authentication is invalid.

findGroupByName

public RemoteGroup findGroupByName(String name)
                            throws RemoteException,
                                   ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the group that matches the supplied name.

Specified by:
findGroupByName in interface RemoteDirectory
Parameters:
name - The name of the group.
Returns:
The populated group.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The group does not exist.

findPrincipalByName

public RemotePrincipal findPrincipalByName(String username)
                                    throws RemoteException,
                                           ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the principal that matches the supplied name.

Specified by:
findPrincipalByName in interface RemoteDirectory
Parameters:
username - The name of the principal.
Returns:
The populated principal.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The principal does not exist.

findRoleByName

public RemoteRole findRoleByName(String name)
                          throws RemoteException,
                                 ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the role that matches the supplied name.

Specified by:
findRoleByName in interface RemoteDirectory
Parameters:
name - The name of the role.
Returns:
The populated role.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

isGroupMember

public boolean isGroupMember(String group,
                             String principal)
                      throws RemoteException
Description copied from interface: RemoteDirectory
Checks if a principal is a member of a group.

Specified by:
isGroupMember in interface RemoteDirectory
Parameters:
group - The group name.
principal - The principal name.
Returns:
true if and only if the principal is a member of the group, otherwise false.
Throws:
RemoteException - An unknown remote exception occured.

isRoleMember

public boolean isRoleMember(String role,
                            String username)
                     throws RemoteException
Description copied from interface: RemoteDirectory
Checks if a principal is a member of a role.

Specified by:
isRoleMember in interface RemoteDirectory
Parameters:
role - The group name.
username - The principal name.
Returns:
true if and only if the principal is a member of the role, otherwise false.
Throws:
RemoteException - An unknown remote exception occured.

removeGroup

public void removeGroup(String name)
                 throws RemoteException,
                        ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the role that matches the supplied name.

Specified by:
removeGroup in interface RemoteDirectory
Parameters:
name - The name of the role.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

removePrincipal

public void removePrincipal(String name)
                     throws RemoteException,
                            ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the principal that matches the supplied name.

Specified by:
removePrincipal in interface RemoteDirectory
Parameters:
name - The name of the principal.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The principal does not exist.

removePrincipalFromGroup

public void removePrincipalFromGroup(String name,
                                     String unsubscribedGroup)
                              throws RemoteException
Description copied from interface: RemoteDirectory
Removes a principal from a group.

Specified by:
removePrincipalFromGroup in interface RemoteDirectory
Parameters:
name - The name of the principal.
unsubscribedGroup - The name of the group.
Throws:
RemoteException - An unknown wire exception occured.

removePrincipalFromRole

public void removePrincipalFromRole(String name,
                                    String removeRole)
                             throws RemoteException
Description copied from interface: RemoteDirectory
Removes a principal from a role.

Specified by:
removePrincipalFromRole in interface RemoteDirectory
Parameters:
name - The name of the principal.
removeRole - The name of the role.
Throws:
RemoteException - An unknown wire exception occured.

removeRole

public void removeRole(String name)
                throws RemoteException,
                       ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the group that matches the supplied name.

Specified by:
removeRole in interface RemoteDirectory
Parameters:
name - The name of the group.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

searchGroups

public List searchGroups(SearchContext searchContext)
                  throws RemoteException
Description copied from interface: RemoteDirectory
Searches for all principals who match the supplied search criteria.

Specified by:
searchGroups in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - An unknown remote exception occured.

searchPrincipals

public List searchPrincipals(SearchContext searchContext)
                      throws RemoteException
Description copied from interface: RemoteDirectory
Search for all principals who match the supplied search criteria.

Specified by:
searchPrincipals in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - an unknown remote exception occured.

searchRoles

public List searchRoles(SearchContext searchContext)
                 throws RemoteException
Description copied from interface: RemoteDirectory
Search for all roles who match the supplied search criteria.

Specified by:
searchRoles in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - an unknown remote exception occured.

testConnection

public void testConnection()
                    throws RemoteException
Description copied from interface: RemoteDirectory
Test if a connection to the directory server can be established.

Specified by:
testConnection in interface RemoteDirectory
Throws:
RemoteException - An unknown wire exception occured.

updateGroup

public RemoteGroup updateGroup(RemoteGroup group)
                        throws RemoteException,
                               ObjectNotFoundException
Description copied from interface: RemoteDirectory
Updates the group by the name attribute.

Specified by:
updateGroup in interface RemoteDirectory
Parameters:
group - The group to update.
Returns:
The populated group.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - the group does not exist.

updatePrincipal

public RemotePrincipal updatePrincipal(RemotePrincipal principal)
                                throws RemoteException,
                                       ObjectNotFoundException
Description copied from interface: RemoteDirectory
Updates the principal by the name attribute.

Specified by:
updatePrincipal in interface RemoteDirectory
Parameters:
principal - The principal to update.
Returns:
The populated principal.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

updateRole

public RemoteRole updateRole(RemoteRole role)
                      throws RemoteException,
                             ObjectNotFoundException
Description copied from interface: RemoteDirectory
Updates the role by the name attribute.

Specified by:
updateRole in interface RemoteDirectory
Parameters:
role - The role to update.
Returns:
The populated role.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

findGroupMemberships

public List findGroupMemberships(String principalName)
                          throws RemoteException,
                                 ObjectNotFoundException
Description copied from interface: RemoteDirectory
Returns a list of group names that a principal is a member of.

Specified by:
findGroupMemberships in interface RemoteDirectory
Returns:
List of group names.
Throws:
RemoteException - An unknown and remote exception occured.
ObjectNotFoundException

findRoleMemberships

public List findRoleMemberships(String principalName)
                         throws RemoteException,
                                ObjectNotFoundException
Description copied from interface: RemoteDirectory
Returns a list of role names that a principal is a member of.

Specified by:
findRoleMemberships in interface RemoteDirectory
Returns:
List of group names.
Throws:
RemoteException - An unknown and remote exception occured.
ObjectNotFoundException


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.