1   package com.atlassian.user.impl.ldap.properties;
2   
3   import javax.naming.directory.SearchControls;
4   
5   /**
6    * Properties which map an LDAP data structure to users and groups for searching an LDAP repository.
7    */
8   public interface LdapSearchProperties
9   {
10      /**
11       * @return base DN of user tree in LDAP server, for example 'ou=users,dc=atlassian,dc=com'
12       */
13      String getBaseUserNamespace();
14  
15      /**
16       * @return LDAP search filter for users, for example '(objectClass=inetOrgPerson)'
17       */
18      String getUserFilter();
19  
20      /**
21       * Returns <code>true</code> if user searches will scan the entire LDAP tree beneath the DN specified by
22       * {@link #getBaseUserNamespace()} (sub-tree scope), or <code>false</code> if only direct children of that
23       * DN should be scanned (one-level scope).
24       *
25       * @see SearchControls#SUBTREE_SCOPE
26       * @see SearchControls#ONELEVEL_SCOPE
27       */
28      boolean isUserSearchScopeAllDepths();
29  
30      /**
31       * @return attribute name of the user identifier attribute on an LDAP user record, for example 'sAMAccountName'
32       */
33      String getUsernameAttribute();
34  
35      /**
36       * @return attribute name of the first name attribute on an LDAP user record, for example 'givenName'
37       */
38      String getFirstnameAttribute();
39  
40      /**
41       * @return attribute name of the surname attribute on an LDAP user record, for example 'sn'
42       */
43      String getSurnameAttribute();
44  
45      /**
46       * @return attribute name of the email attribute on an LDAP user record, for example 'mail'
47       */
48      String getEmailAttribute();
49  
50      /**
51       * @return base DN of group tree in LDAP server, for example 'ou=groups,dc=atlassian,dc=com'
52       */
53      String getBaseGroupNamespace();
54  
55      /**
56       * @return LDAP search filter for group, for example '(objectClass=groupOfNames)'
57       */
58      String getGroupFilter();
59  
60      /**
61       * Returns <code>true</code> if group searches will scan the entire LDAP tree beneath the DN specified by
62       * {@link #getBaseGroupNamespace()} (sub-tree scope), or <code>false</code> if only direct children of that
63       * DN should be scanned (one-level scope).
64       *
65       * @see SearchControls#SUBTREE_SCOPE
66       * @see SearchControls#ONELEVEL_SCOPE
67       */
68      boolean isGroupSearchScopeAllDepths();
69  
70      /**
71       * @return attribute name of the group identifier attribute on an LDAP group record, for example 'cn'
72       */
73      String getGroupnameAttribute();
74  
75      /**
76       * @return maximum time LDAP connection will wait for search results to return before aborting the search.
77       * Measured in milliseconds, where 0 means wait indefinitely.
78       * @see SearchControls#getTimeLimit()
79       */
80      int getTimeLimitMillis();
81  
82  }