Skip to content

Commit 5ff932e

Browse files
authored
Ldap fixes (#3694)
* pass domainid for list users * passing arg in wizzard * adding userfilter to list ldap users and usersource to response port of list ldap users tests to java * assertion of differnt junit ldap methods * broken test for directory server (and others) * embedded context loading * add user and query test * UI: filter options passing filter and domain and onchange trigger * disable tests that only work in ide prereqs for domain-linkage fixed move trigger to the right location in code trigger for changing domain * logging, comments and refactor implement search users per domain retrieve appropriate list of users to filter get domain specific ldap provider * query cloudstack users with now db filter * recreate ldap linked account should succeed * disable auto import users that don't exist * ui choice and text * import filter and potential remove from list bug fixed * fix rights for domain admins * list only member of linked groups not of principle group * Do not show ldap user filter if not importing from ldap do not delete un-needed items from dialog permanently delete from temp object not from global one * localdomain should not filterout users not imported from ldap * several types of authentication handling errors fixed and unit tested * conflict in output name * add conflict source field to generic import dialog * replace reflextion by enum member call * conflict is now called conflict 🎉
1 parent 9b7acfd commit 5ff932e

35 files changed

Lines changed: 3838 additions & 290 deletions

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ public class ApiConstants {
336336
public static final String URL = "url";
337337
public static final String USAGE_INTERFACE = "usageinterface";
338338
public static final String USER_DATA = "userdata";
339+
public static final String USER_FILTER = "userfilter";
339340
public static final String USER_ID = "userid";
341+
public static final String USER_SOURCE = "usersource";
342+
public static final String USER_CONFLICT_SOURCE = "conflictingusersource";
340343
public static final String USE_SSL = "ssl";
341344
public static final String USERNAME = "username";
342345
public static final String USER_CONFIGURABLE = "userconfigurable";

api/src/main/java/org/apache/cloudstack/query/QueryService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public interface QueryService {
111111

112112
ListResponse<UserResponse> searchForUsers(ListUsersCmd cmd) throws PermissionDeniedException;
113113

114+
ListResponse<UserResponse> searchForUsers(Long domainId, boolean recursive) throws PermissionDeniedException;
115+
114116
ListResponse<EventResponse> searchForEvents(ListEventsCmd cmd);
115117

116118
ListResponse<ResourceTagResponse> listTags(ListTagsCmd cmd);

plugins/user-authenticators/ldap/pom.xml

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,23 @@
2727
<version>4.14.0.0-SNAPSHOT</version>
2828
<relativePath>../../pom.xml</relativePath>
2929
</parent>
30+
31+
<properties>
32+
<ads.version>2.0.0.AM25</ads.version>
33+
<gmaven.version>1.5</gmaven.version>
34+
<ldap-maven.version>1.1.3</ldap-maven.version>
35+
<ldapunit.version>1.1.3</ldapunit.version>
36+
<groovy.version>1.1-groovy-2.4</groovy.version>
37+
<zapdot.version>0.7</zapdot.version>
38+
<unboundedid.version>4.0.4</unboundedid.version>
39+
</properties>
40+
3041
<build>
3142
<plugins>
3243
<plugin>
3344
<groupId>org.codehaus.gmaven</groupId>
3445
<artifactId>gmaven-plugin</artifactId>
35-
<version>1.3</version>
46+
<version>${gmaven.version}</version>
3647
<configuration>
3748
<providerSelection>1.7</providerSelection>
3849
</configuration>
@@ -58,7 +69,7 @@
5869
<dependency>
5970
<groupId>org.codehaus.gmaven.runtime</groupId>
6071
<artifactId>gmaven-runtime-1.7</artifactId>
61-
<version>1.3</version>
72+
<version>${gmaven.version}</version>
6273
<exclusions>
6374
<exclusion>
6475
<groupId>org.codehaus.groovy</groupId>
@@ -81,38 +92,126 @@
8192
<include>**/*Spec.groovy</include>
8293
<include>**/*Test.java</include>
8394
</includes>
95+
<excludes>
96+
<exclude>META-INF/*.SF</exclude>
97+
<exclude>META-INF/*.DSA</exclude>
98+
<exclude>META-INF/*.RSA</exclude>
99+
</excludes>
84100
</configuration>
85101
</plugin>
86102
<plugin>
87103
<groupId>com.btmatthews.maven.plugins</groupId>
88104
<artifactId>ldap-maven-plugin</artifactId>
89-
<version>1.1.0</version>
105+
<version>${ldap-maven.version}</version>
90106
<configuration>
91107
<monitorPort>11389</monitorPort>
92108
<monitorKey>ldap</monitorKey>
93109
<daemon>false</daemon>
94110
<rootDn>dc=cloudstack,dc=org</rootDn>
95111
<ldapPort>10389</ldapPort>
96-
<ldifFile>test/resources/cloudstack.org.ldif</ldifFile>
112+
<ldifFile>src/test/resources/cloudstack.org.ldif</ldifFile>
97113
</configuration>
98114
</plugin>
99115
</plugins>
100-
<testSourceDirectory>test</testSourceDirectory>
116+
<testSourceDirectory>src/test/java</testSourceDirectory>
101117
</build>
102118
<dependencies>
103119
<!-- Mandatory dependencies for using Spock -->
120+
<dependency>
121+
<groupId>com.btmatthews.ldapunit</groupId>
122+
<artifactId>ldapunit</artifactId>
123+
<version>${ldapunit.version}</version>
124+
</dependency>
104125
<dependency>
105126
<groupId>org.spockframework</groupId>
106127
<artifactId>spock-core</artifactId>
107-
<version>1.1-groovy-2.4</version>
128+
<version>${groovy.version}</version>
108129
<scope>test</scope>
109130
</dependency>
110-
111131
<!-- Optional dependencies for using Spock -->
112132
<dependency> <!-- enables mocking of classes (in addition to interfaces) -->
113133
<groupId>cglib</groupId>
114134
<artifactId>cglib-nodep</artifactId>
115135
<scope>test</scope>
116136
</dependency>
137+
<dependency>
138+
<groupId>org.zapodot</groupId>
139+
<artifactId>embedded-ldap-junit</artifactId>
140+
<version>${zapdot.version}</version>
141+
</dependency>
142+
<dependency>
143+
<groupId>com.unboundid</groupId>
144+
<artifactId>unboundid-ldapsdk</artifactId>
145+
<version>${unboundedid.version}</version>
146+
<scope>test</scope>
147+
</dependency>
148+
<dependency>
149+
<groupId>org.mockito</groupId>
150+
<artifactId>mockito-all</artifactId>
151+
<version>${cs.mockito.version}</version>
152+
<scope>compile</scope>
153+
</dependency>
154+
<dependency>
155+
<groupId>junit</groupId>
156+
<artifactId>junit</artifactId>
157+
<version>${cs.junit.version}</version>
158+
<scope>compile</scope>
159+
</dependency>
160+
<dependency>
161+
<groupId>org.apache.directory.server</groupId>
162+
<artifactId>apacheds-server-integ</artifactId>
163+
<version>${ads.version}</version>
164+
<scope>test</scope>
165+
<exclusions>
166+
<!--
167+
shared-ldap-schema module needs to be excluded to avoid multiple schema resources on the classpath
168+
-->
169+
<exclusion>
170+
<groupId>org.apache.directory.shared</groupId>
171+
<artifactId>shared-ldap-schema</artifactId>
172+
</exclusion>
173+
</exclusions>
174+
</dependency>
175+
<dependency>
176+
<groupId>org.apache.directory.server</groupId>
177+
<artifactId>apacheds-core-constants</artifactId>
178+
<version>${ads.version}</version>
179+
<scope>compile</scope>
180+
</dependency>
181+
<dependency>
182+
<groupId>org.apache.directory.server</groupId>
183+
<artifactId>apacheds-core-annotations</artifactId>
184+
<version>${ads.version}</version>
185+
<scope>compile</scope>
186+
</dependency>
187+
<dependency>
188+
<groupId>org.apache.directory.server</groupId>
189+
<artifactId>apacheds-core</artifactId>
190+
<version>${ads.version}</version>
191+
<scope>compile</scope>
192+
</dependency>
193+
<dependency>
194+
<groupId>org.apache.directory.server</groupId>
195+
<artifactId>apacheds-protocol-ldap</artifactId>
196+
<version>${ads.version}</version>
197+
<scope>compile</scope>
198+
</dependency>
199+
<dependency>
200+
<groupId>org.apache.directory.server</groupId>
201+
<artifactId>apacheds-jdbm-partition</artifactId>
202+
<version>${ads.version}</version>
203+
<scope>compile</scope>
204+
</dependency>
205+
<dependency>
206+
<groupId>org.apache.directory.server</groupId>
207+
<artifactId>apacheds-ldif-partition</artifactId>
208+
<version>${ads.version}</version>
209+
<scope>compile</scope>
210+
</dependency>
211+
<dependency>
212+
<groupId>commons-io</groupId>
213+
<artifactId>commons-io</artifactId>
214+
<version>${cs.commons-io.version}</version>
215+
</dependency>
117216
</dependencies>
118217
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api;
18+
19+
public interface LdapConstants {
20+
String PRINCIPAL = "principal";
21+
}

0 commit comments

Comments
 (0)