|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.crowd.integration.directory.connector.LDAPDirectory
public abstract class LDAPDirectory
Geneirc LDAP connector.
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 |
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 |
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 |
---|
protected static final String NAME
protected static final String UNABLE_TO_CONNECT
protected static final String PRINCIPAL_NO_VALID_PASSWORD
public static String CONNECTION_INITIAL_CONTEXT_FACTORY
public static String CONNECTION_SECURITY_AUTHENTICATION
public static String CONNECTION_SSL_SECURITY_PROTOCOL
public static String CONNECTION_FACTORY
public static String CONNECTION_FACTORY_SSL_IMPL
protected Map attributes
Attributes
for the entity.
public static final String LDAP_URL_KEY
Attribute
key for the LDAP url.
public static final String LDAP_SECURE_KEY
Attribute
key for the SSL required flag..
public static final String LDAP_BASEDN_KEY
Attribute
key for the LDAP base DN.
public static final String LDAP_USERDN_KEY
Attribute
key for the LDAP user DN.
public static final String LDAP_PASSWORD_KEY
Attribute
key for the LDAP password.
public static final String GROUP_DN_ADDITION
Attribute
key for the LDAP group base dn.
public static final String GROUP_DESCRIPTION_KEY
Attribute
key for the LDAP group description attribute.
public static final String GROUP_NAME_KEY
Attribute
key for the LDAP group name attribute.
public static final String GROUP_OBJECTCLASS_KEY
Attribute
key for the LDAP group object class.
public static final String GROUP_USERNAMES_KEY
Attribute
key for the LDAP group membership attribute.
public static final String ROLE_DN_ADDITION
Attribute
key for the LDAP role base dn.
public static final String ROLE_DESCRIPTION_KEY
Attribute
key for the LDAP role description attribute.
public static final String ROLE_NAME_KEY
Attribute
key for the LDAP role name attribute.
public static final String ROLE_OBJECTCLASS_KEY
Attribute
key for the LDAP role object class.
public static final String ROLE_USERNAMES_KEY
Attribute
key for the LDAP role membership attribute.
public static final String USER_DN_ADDITION
Attribute
key for the LDAP principal base dn.
public static final String USER_EMAIL_KEY
Attribute
key for the LDAP principal email attribute.
public static final String USER_FIRSTNAME_KEY
Attribute
key for the LDAP principal lastname attribute.
public static final String USER_GROUP_KEY
Attribute
key for the LDAP principal memberships attribute.
public static final String USER_LASTNAME_KEY
Attribute
key for the LDAP principal firstname attribute.
public static final String USER_OBJECTCLASS_KEY
Attribute
key for the LDAP principal object class.
public static final String USER_USERNAME_KEY
Attribute
key for the LDAP principal name attribute.
public static final String USER_PASSWORD_KEY
Attribute
key for the LDAP principal password attribute.
protected static int DEFAULT_PAGE_SIZE
protected static String LDAP_OBJECTCLASS
protected static String DISTINGUISHED_NAME
Constructor Detail |
---|
public LDAPDirectory()
Method Detail |
---|
public long getID()
RemoteDirectory
ID
of the directory store.
getID
in interface RemoteDirectory
ID
.public void setID(long ID)
RemoteDirectory
ID
will be set by the
crowd framework.
setID
in interface RemoteDirectory
ID
- The ID
.public static Map getImplementations()
public static Map getConfigurationDetails()
properties
associated
with that LDAP connector.
public Map getAttributes()
getAttributes
in interface RemoteDirectory
public void setAttributes(Map attributes)
setAttributes
in interface RemoteDirectory
attributes
- The attributes.public AttributeValues getAttribute(String key)
key
- They key.
protected String getSingleAttribute(String key)
key
- The key.
public void setAttribute(String key, String value)
key
- They key.value
- The value.public void setAttribute(String key, AttributeValues values)
key
- The key.values
- They values.protected boolean isSecureSSL()
true
if and only if the connection must be securem, otherwise false
.protected LdapContext connect() throws RemoteException
RemoteException
- A remote exception occured while trying to connect to the LDAP server.protected void disconnect(LdapContext context)
context
- The LDAP connection.protected static byte[] parseControlResponse(Control[] controls)
controls
- The directory controls to process.
protected StringBuffer buildSearchObject(String objectClass)
objectClass
- The LDAP object class type.
protected StringBuffer buildSearch(String attribute, String value, boolean wildcard)
attribute
- The object attribute.value
- The object value.wildcard
- If the object value should be a wildcard.
protected RemoteGroup populateGroup(LdapContext connection, Attributes attributes, boolean processMembers) throws NamingException
group
using directory server attributes.
connection
- LDAP connection.attributes
- LDAP attributes.processMembers
- true
if and only if the members should be popluated, otherwise false
.
NamingException
- An LDAP name exception occured.protected RemoteRole populateRole(LdapContext connection, Attributes attributes, boolean processMembers) throws NamingException
role
using directory server attributes.
connection
- LDAP connection.attributes
- LDAP attributes.processMembers
- true
if and only if the members should be popluated, otherwise false
.
NamingException
- An LDAP name exception occured.protected Set processMembers(LdapContext connection, Attributes attributes) throws NamingException
connection
- LDAP connection.attributes
- LDAP attributes.
principals
.
NamingException
- An LDAP name exception occured.protected RemotePrincipal populatePrincipal(LdapContext connection, Attributes attributes, boolean processAttributes) throws NamingException
principal
using directory server attributes.
connection
- LDAP connection.attributes
- LDAP attribute.processAttributes
- true
if and only if the members attributes should be popluated, otherwise false
.
NamingException
- An LDAP name exception occured.protected Map populateAttributes(Attributes ldapAttributes) throws NamingException
values
.
ldapAttributes
- LDAP attributes.
values
.
NamingException
- An LDAP name exception occured.protected List populateAttribute(Attribute ldapAttribute) throws NamingException
ldapAttribute
- LDAP attribute.
NamingException
- An LDAP name exception occured.protected String buildBaseDN(String entityKeyType)
entityKeyType
- The object entity type.
protected String buildEntityDN(LdapContext connection, String objectClass, String dnAddition, String nameKey, String name) throws NamingException, ObjectNotFoundException
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.
NamingException
- An LDAP name exception occured.
ObjectNotFoundException
- Entity does not exist.protected boolean isMemeber(LdapContext connection, String objectClass, String dnAddition, String nameKey, String membersKey, String group, String principal) throws NamingException
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.
true
if and only if the princpial is a member, otherwise false
.
NamingException
- An LDAP name exception occured.protected void addContainerEntity(LdapContext connection, String objectClass, String dnAdditionKey, String entityNameKey, String entityDescriptionKey, String entityMemberKey, String name, String description, Set members) throws NamingException, ObjectNotFoundException
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
.
NamingException
- An LDAP name exception occured.
ObjectNotFoundException
- Unable to add the principal to the container.protected void removeMemberFromContainerEntity(LdapContext connection, String objectClass, String dnAddition, String nameKey, String memberKey, String containername, String membername) throws NamingException, RemoteException
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.
NamingException
- An LDAP name exception occured.
RemoteException
- Unable to remove the member.protected void addMemberToContainerEntity(LdapContext connection, String objectClass, String dnAddition, String nameKey, String memberKey, String containername, String membername) throws NamingException, RemoteException
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.
NamingException
- An LDAP name exception occured.
RemoteException
- Unable to remove the member.protected Attributes addPrincipalGeneric(RemotePrincipal principal)
principal
into LDAP attributes
.
principal
- The principal.
public RemoteGroup addGroup(RemoteGroup group) throws InvalidGroupException, RemoteException
RemoteDirectory
addGroup
in interface RemoteDirectory
group
- The group to add.
InvalidGroupException
- The supplied group is invalid.
RemoteException
- An unknown remote exception occured.public void addPrincipalToGroup(String name, String group) throws RemoteException
RemoteDirectory
addPrincipalToGroup
in interface RemoteDirectory
name
- The name of the principal.group
- The name of the group.
RemoteException
- An unknown wire exception occured.public void addPrincipalToRole(String name, String role) throws RemoteException
RemoteDirectory
addPrincipalToRole
in interface RemoteDirectory
name
- The name of the principal.role
- The name of the role.
RemoteException
- An unknown wire exception occured.public RemoteRole addRole(RemoteRole role) throws InvalidRoleException, RemoteException
RemoteDirectory
addRole
in interface RemoteDirectory
role
- The role to add.
InvalidRoleException
- The supplied role is invalid.
RemoteException
- An unknown remote exception occured.public RemotePrincipal authenticate(String name, PasswordCredential[] credentials) throws RemoteException, InvalidPrincipalException, InactiveAccountException, InvalidAuthenticationException
RemoteDirectory
authenticate
in interface RemoteDirectory
name
- The name of the principal.credentials
- The supplied credentials.
RemoteException
- An unknown remote exception occured.
InvalidPrincipalException
- The supplied principal is invalid.
InactiveAccountException
- The supplied principal is inactive.
InvalidAuthenticationException
- The supplied authentication is invalid.public RemoteGroup findGroupByName(String name) throws RemoteException, ObjectNotFoundException
RemoteDirectory
group
that matches the supplied name
.
findGroupByName
in interface RemoteDirectory
name
- The name of the group.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The group does not exist.public RemotePrincipal findPrincipalByName(String username) throws RemoteException, ObjectNotFoundException
RemoteDirectory
principal
that matches the supplied name
.
findPrincipalByName
in interface RemoteDirectory
username
- The name of the principal.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The principal does not exist.public RemoteRole findRoleByName(String name) throws RemoteException, ObjectNotFoundException
RemoteDirectory
role
that matches the supplied name
.
findRoleByName
in interface RemoteDirectory
name
- The name of the role.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The role does not exist.public boolean isGroupMember(String group, String principal) throws RemoteException
RemoteDirectory
isGroupMember
in interface RemoteDirectory
group
- The group name.principal
- The principal name.
true
if and only if the principal is a member of the group, otherwise false
.
RemoteException
- An unknown remote exception occured.public boolean isRoleMember(String role, String username) throws RemoteException
RemoteDirectory
isRoleMember
in interface RemoteDirectory
role
- The group name.username
- The principal name.
true
if and only if the principal is a member of the role, otherwise false
.
RemoteException
- An unknown remote exception occured.public void removeGroup(String name) throws RemoteException, ObjectNotFoundException
RemoteDirectory
role
that matches the supplied name
.
removeGroup
in interface RemoteDirectory
name
- The name of the role.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The role does not exist.public void removePrincipal(String name) throws RemoteException, ObjectNotFoundException
RemoteDirectory
principal
that matches the supplied name
.
removePrincipal
in interface RemoteDirectory
name
- The name of the principal.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The principal does not exist.public void removePrincipalFromGroup(String name, String unsubscribedGroup) throws RemoteException
RemoteDirectory
removePrincipalFromGroup
in interface RemoteDirectory
name
- The name of the principal.unsubscribedGroup
- The name of the group.
RemoteException
- An unknown wire exception occured.public void removePrincipalFromRole(String name, String removeRole) throws RemoteException
RemoteDirectory
removePrincipalFromRole
in interface RemoteDirectory
name
- The name of the principal.removeRole
- The name of the role.
RemoteException
- An unknown wire exception occured.public void removeRole(String name) throws RemoteException, ObjectNotFoundException
RemoteDirectory
group
that matches the supplied name
.
removeRole
in interface RemoteDirectory
name
- The name of the group.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The role does not exist.public List searchGroups(SearchContext searchContext) throws RemoteException
RemoteDirectory
principals
who match the supplied search criteria.
searchGroups
in interface RemoteDirectory
searchContext
- The search criteria.
results
.
RemoteException
- An unknown remote exception occured.public List searchPrincipals(SearchContext searchContext) throws RemoteException
RemoteDirectory
principals
who match the supplied search criteria.
searchPrincipals
in interface RemoteDirectory
searchContext
- The search criteria.
results
.
RemoteException
- an unknown remote exception occured.public List searchRoles(SearchContext searchContext) throws RemoteException
RemoteDirectory
roles
who match the supplied search criteria.
searchRoles
in interface RemoteDirectory
searchContext
- The search criteria.
results
.
RemoteException
- an unknown remote exception occured.public void testConnection() throws RemoteException
RemoteDirectory
testConnection
in interface RemoteDirectory
RemoteException
- An unknown wire exception occured.public RemoteGroup updateGroup(RemoteGroup group) throws RemoteException, ObjectNotFoundException
RemoteDirectory
name
attribute.
updateGroup
in interface RemoteDirectory
group
- The group to update.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- the group does not exist.public RemotePrincipal updatePrincipal(RemotePrincipal principal) throws RemoteException, ObjectNotFoundException
RemoteDirectory
name
attribute.
updatePrincipal
in interface RemoteDirectory
principal
- The principal to update.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The role does not exist.public RemoteRole updateRole(RemoteRole role) throws RemoteException, ObjectNotFoundException
RemoteDirectory
name
attribute.
updateRole
in interface RemoteDirectory
role
- The role to update.
RemoteException
- An unknown remote exception occured.
ObjectNotFoundException
- The role does not exist.public List findGroupMemberships(String principalName) throws RemoteException, ObjectNotFoundException
RemoteDirectory
findGroupMemberships
in interface RemoteDirectory
RemoteException
- An unknown and remote exception occured.
ObjectNotFoundException
public List findRoleMemberships(String principalName) throws RemoteException, ObjectNotFoundException
RemoteDirectory
findRoleMemberships
in interface RemoteDirectory
RemoteException
- An unknown and remote exception occured.
ObjectNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |