|
69 | 69 | * @return URL where the LDAP server can be reached |
70 | 70 | */ |
71 | 71 | String url() default ""; |
| 72 | + |
| 73 | + /** |
| 74 | + * Distinguished name for the application or administrative user that will be used to |
| 75 | + * make the initial connection to the LDAP and perform searches and lookups. |
| 76 | + * |
| 77 | + * This value is needed if user or group lookup will be done. If the |
| 78 | + * store will be used only to authenticate users or lookup groups |
| 79 | + * using an explicit DN (see callerBaseDn and groupMemberOfAttribute), |
| 80 | + * it is not needed. When this member is filled in, the value of callerBaseDn is ignored. |
| 81 | + * |
| 82 | + * This user needs search permission in the LDAP for persons and/or groups. |
| 83 | + * <p> |
| 84 | + * E.g. <code>uid=ldap,ou=apps,dc=jsr375,dc=net</code> |
| 85 | + * |
| 86 | + * @return The distinguished name for the application user. |
| 87 | + */ |
| 88 | + String bindDn() default ""; |
72 | 89 |
|
73 | 90 | /** |
74 | | - * Base of the distinguished name that contains the caller name. |
| 91 | + * Password for the application/admin user defined by the bindDn member. |
| 92 | + * Only used when the member bindDn is filled in. |
| 93 | + * |
| 94 | + * @return password for the application user. |
| 95 | + */ |
| 96 | + String bindDnPassword() default ""; |
| 97 | + |
| 98 | + /** |
| 99 | + * Base distinguished name for users in the LDAP store. |
75 | 100 | * E.g. <code>ou=caller,dc=jsr375,dc=net</code> |
76 | | - * When this member value is specified, direct binding is attempted, see also baseDn |
| 101 | + * When this member value is specified, and bindDn is not, direct binding is attempted. |
| 102 | + * See also bindDn. |
| 103 | + * |
| 104 | + * The callerNameAttribute must be specified along with this attribute so that the |
| 105 | + * runtime can create the "leaf" RDN to concatenate with this base DN to create the |
| 106 | + * full DN for the caller. |
77 | 107 | * |
78 | | - * @return Base of the distinguished name that contains the caller name |
| 108 | + * @return Base of the distinguished name that contains the caller name. |
79 | 109 | */ |
80 | 110 | String callerBaseDn() default ""; |
81 | 111 |
|
82 | 112 | /** |
83 | | - * Name of the attribute that contains the caller name in the node |
84 | | - * just below the one identified by {@link #callerBaseDn()}. |
| 113 | + * Name of the attribute that contains the callers name in the person object. |
85 | 114 | * E.g. <code>uid</code> |
86 | 115 | * <p> |
87 | | - * Example for the relationship with {@link #callerBaseDn()} and the name |
88 | | - * of the caller that needs to be authenticated: |
89 | | - * <br> |
90 | | - * Given the DN <code>uid=peter,ou=caller,dc=jsr375,dc=net</code>, |
91 | | - * <ul> |
92 | | - * <li> {@link #callerNameAttribute()} corresponds to <code>uid</code> </li> |
93 | | - * <li> {@link #callerBaseDn()} corresponds to <code>ou=caller,dc=jsr375,dc=net</code> </li> |
94 | | - * <li> <code>peter</code> is the caller name that needs to be authenticated </li> |
95 | | - * </ul> |
| 116 | + * This attribute will be used, with callerBaseDn, to construct user DNs for direct binding. |
| 117 | + * and to retrieve the caller's name when the person object is obtained via search. The value |
| 118 | + * of this attribute is returned in the {@link CallerPrincipal} following a successful validation. |
96 | 119 | * <p> |
97 | 120 | * The following gives an example in ldif format: |
98 | 121 | * <pre> |
|
113 | 136 | String callerNameAttribute() default "uid"; |
114 | 137 |
|
115 | 138 | /** |
116 | | - * Base of the distinguished name that contains the groups |
| 139 | + * Search base for finding the user. |
| 140 | + * Only used when the member bindDn is filled in. |
| 141 | + * Overrides callerBaseDn, if configured, causing caller search |
| 142 | + * to be used instead of direct binding. |
| 143 | + * |
| 144 | + * @return Base for searching the LDAP tree for callers. |
| 145 | + */ |
| 146 | + String callerSearchBase() default ""; |
| 147 | + |
| 148 | + /** |
| 149 | + * Search expression to find callers when callerSearchBase is set. |
| 150 | + * Only used when the member bindDn is filled in. |
| 151 | + * |
| 152 | + * @return Search expression to find callers. |
| 153 | + */ |
| 154 | + String callerSearchExpression() default ""; |
| 155 | + |
| 156 | + /** |
| 157 | + * Search scope for caller searches, determines depth |
| 158 | + * of the search in the LDAP tree. |
| 159 | + * Only used when the member bindDn is filled in. |
| 160 | + * |
| 161 | + * Legal values are "subtree", "onelevel". |
| 162 | + * |
| 163 | + * @return The search scope |
| 164 | + */ |
| 165 | + String callerSearchScope() default "subtree"; |
| 166 | + |
| 167 | + /** |
| 168 | + * Base distinguished name that contains groups |
117 | 169 | * E.g. <code>ou=group,dc=jsr375,dc=net</code> |
| 170 | + * |
| 171 | + * For a store that performs group lookup |
| 172 | + * |
| 173 | + * @return Base for searching the LDAP tree for groups |
| 174 | + */ |
| 175 | + String groupSearchBase() default ""; |
| 176 | + |
| 177 | + /** |
| 178 | + * Search expression to find groups when groupSearchBase is set. |
| 179 | + * Only used when the member bindDn is filled in. |
118 | 180 | * |
119 | | - * @return Base of the distinguished name that contains the groups |
| 181 | + * @return Search expression to find the user. |
| 182 | + */ |
| 183 | + String groupSearchExpression() default ""; |
| 184 | + |
| 185 | + /** |
| 186 | + * Search scope for group searches, determines depth |
| 187 | + * of the search in the LDAP tree. |
| 188 | + * Only used when the member bindDn is filled in. |
| 189 | + * |
| 190 | + * Legal values are "subtree", "onelevel". |
| 191 | + * |
| 192 | + * @return The search scope |
120 | 193 | */ |
121 | | - String groupBaseDn() default ""; |
| 194 | + String groupSearchScope() default "subtree"; |
122 | 195 |
|
123 | 196 | /** |
124 | | - * Name of the attribute that contains the group name in the node |
125 | | - * just below the one identified by {@link #groupBaseDn()}. |
| 197 | + * Name of the attribute of a group object that represents the group name. |
126 | 198 | * E.g. <code>cn</code> |
127 | | - * <p> |
128 | | - * Example for the relationship with {@link #groupBaseDn()} and the role name |
129 | | - * <br> |
130 | | - * Given the DN <code>cn=foo,ou=group,dc=jsr375,dc=net</code>, |
131 | | - * <ul> |
132 | | - * <li> {@link #groupNameAttribute()} corresponds to <code>cn</code> </li> |
133 | | - * <li> {@link #groupBaseDn()} corresponds to <code>ou=group,dc=jsr375,dc=net</code> </li> |
134 | | - * <li> <code>foo</code> is the group name that will be returned by the store when authentication succeeds</li> |
135 | | - * </ul> |
136 | 199 | * |
137 | | - * @return Name of the attribute that contains the group name |
| 200 | + * @return Name of the attribute that represents the group name |
138 | 201 | */ |
139 | 202 | String groupNameAttribute() default "cn"; |
140 | 203 |
|
141 | 204 | /** |
142 | | - * DN attribute for the group DN that identifies the callers that are in that group. |
| 205 | + * Name of the attribute in a group object that identifies the |
| 206 | + * members of the group. |
143 | 207 | * E.g. <code>member</code> |
144 | 208 | * <p> |
145 | | - * The value of this attribute has to the full DN of the caller. The following gives an example |
| 209 | + * The value of this attribute must be the full DN of the caller. The following gives an example |
146 | 210 | * entry in ldif format: |
147 | 211 | * <pre> |
148 | 212 | * <code> |
|
155 | 219 | * </code> |
156 | 220 | * </pre> |
157 | 221 | * |
158 | | - * @return DN attribute for the group DN |
| 222 | + * @return Attribute for the group members |
159 | 223 | */ |
160 | | - String groupCallerDnAttribute() default "member"; |
| 224 | + String groupMemberAttribute() default "member"; |
161 | 225 |
|
162 | 226 | /** |
163 | | - * Base of the distinguished name for the application user that will be used to make the initial connection to the LDAP. |
164 | | - * This account needs search persons in the LDAP to find the actual DN of the user who we need to authenticate. |
165 | | - * When this member is filled in, the value in callerBaseDn is ignored. |
| 227 | + * Name of the attribute in a person object that identifies the groups |
| 228 | + * the caller belongs to. |
| 229 | + * E.g. <code>memberOf</code> |
166 | 230 | * <p> |
167 | | - * E.g. <code>uid=ldap,ou=apps,dc=jsr375,dc=net</code> |
168 | | - * |
169 | | - * @return The distinguished name for the application user. |
170 | | - */ |
171 | | - String baseDn() default ""; |
172 | | - |
173 | | - /** |
174 | | - * Password for the application user defined by the baseDn member. |
175 | | - * Only used when the member baseDN is filled in. |
176 | | - * |
177 | | - * @return password for the application user. |
178 | | - */ |
179 | | - String password() default ""; |
180 | | - |
181 | | - /** |
182 | | - * Search base for finding the user. |
183 | | - * Only used when the member baseDN is filled in. |
184 | | - * |
185 | | - * @return base for searching the LDAP tree for the user. |
186 | | - */ |
187 | | - String searchBase() default ""; |
188 | | - |
189 | | - /** |
190 | | - * Search expression to find |
191 | | - * Only used when the member baseDN is filled in. |
| 231 | + * This attribute is used only if: a) group search is not configured |
| 232 | + * (i.e., no groupSearchBase and groupSearchExpression configured); and, |
| 233 | + * b) the user's DN is available, either because groups are being returned |
| 234 | + * during the credential validation phase by an identity store that performs |
| 235 | + * both validation and group lookup, or because the DN is available in the |
| 236 | + * {@link CredentialValidationResult} passed to the |
| 237 | + * {@link IdentityStore#getCallerGroups(CredentialValidationResult)} method. |
| 238 | + * <p> |
| 239 | + * The value of this attribute must be the full DN of the group. The following gives an example |
| 240 | + * entry in ldif format: |
| 241 | + * <pre> |
| 242 | + * <code> |
| 243 | + * dn: uid=peter,ou=caller,dc=jsr375,dc=net |
| 244 | + * objectclass: top |
| 245 | + * objectclass: uidObject |
| 246 | + * objectclass: person |
| 247 | + * uid: peter |
| 248 | + * cn: Peter Smith |
| 249 | + * memberOf: cn=foo,ou=group,dc=jsr375,dc=net |
| 250 | + * memberOf: cn=bar,ou=group,dc=jsr375,dc=net |
| 251 | + * </code> |
| 252 | + * </pre> |
192 | 253 | * |
193 | | - * @return Search expression to find the user. |
| 254 | + * @return Attribute for group membership |
194 | 255 | */ |
195 | | - String searchExpression() default ""; |
| 256 | + String groupMemberOfAttribute() default "memberOf"; |
196 | 257 |
|
197 | 258 | /** |
198 | 259 | * Determines the order in case multiple IdentityStores are found. |
|
0 commit comments