Skip to content

Commit 81d63f1

Browse files
committed
Working version - LDAP + Spring Boot
1 parent 809554d commit 81d63f1

File tree

17 files changed

+310
-406
lines changed

17 files changed

+310
-406
lines changed

spring-security-mvc-ldap/pom.xml

Lines changed: 17 additions & 259 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<name>spring-security-mvc-ldap</name>
99
<packaging>war</packaging>
10-
10+
1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
@@ -16,88 +16,23 @@
1616

1717
<dependencies>
1818

19-
<!-- Spring Security -->
20-
<dependency>
21-
<groupId>org.springframework.security</groupId>
22-
<artifactId>spring-security-web</artifactId>
23-
<version>${org.springframework.security.version}</version>
24-
</dependency>
25-
<dependency>
26-
<groupId>org.springframework.security</groupId>
27-
<artifactId>spring-security-config</artifactId>
28-
<version>${org.springframework.security.version}</version>
29-
</dependency>
30-
31-
<!-- Spring -->
32-
33-
<dependency>
34-
<groupId>org.springframework</groupId>
35-
<artifactId>spring-core</artifactId>
36-
<version>${org.springframework.version}</version>
37-
<exclusions>
38-
<exclusion>
39-
<artifactId>commons-logging</artifactId>
40-
<groupId>commons-logging</groupId>
41-
</exclusion>
42-
</exclusions>
43-
</dependency>
44-
<dependency>
45-
<groupId>org.springframework</groupId>
46-
<artifactId>spring-context</artifactId>
47-
<version>${org.springframework.version}</version>
48-
</dependency>
49-
<dependency>
50-
<groupId>org.springframework</groupId>
51-
<artifactId>spring-jdbc</artifactId>
52-
<version>${org.springframework.version}</version>
53-
</dependency>
54-
<dependency>
55-
<groupId>org.springframework</groupId>
56-
<artifactId>spring-beans</artifactId>
57-
<version>${org.springframework.version}</version>
58-
</dependency>
59-
<dependency>
60-
<groupId>org.springframework</groupId>
61-
<artifactId>spring-aop</artifactId>
62-
<version>${org.springframework.version}</version>
63-
</dependency>
64-
<dependency>
65-
<groupId>org.springframework</groupId>
66-
<artifactId>spring-tx</artifactId>
67-
<version>${org.springframework.version}</version>
68-
</dependency>
69-
<dependency>
70-
<groupId>org.springframework</groupId>
71-
<artifactId>spring-expression</artifactId>
72-
<version>${org.springframework.version}</version>
73-
</dependency>
74-
19+
<!-- Spring Boot Dependencies -->
7520
<dependency>
76-
<groupId>org.springframework</groupId>
77-
<artifactId>spring-web</artifactId>
78-
<version>${org.springframework.version}</version>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-security</artifactId>
7923
</dependency>
8024
<dependency>
81-
<groupId>org.springframework</groupId>
82-
<artifactId>spring-webmvc</artifactId>
83-
<version>${org.springframework.version}</version>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
8427
</dependency>
8528

86-
87-
88-
29+
<!-- LDAP Dependencies -->
8930
<dependency>
90-
<groupId>org.springframework.boot</groupId>
91-
<artifactId>spring-boot-starter-web</artifactId>
92-
<version>1.1.1.RELEASE</version>
31+
<groupId>org.springframework.security</groupId>
32+
<artifactId>spring-security-ldap</artifactId>
33+
<version>3.2.4.RELEASE</version>
9334
</dependency>
9435

95-
<dependency>
96-
<groupId>org.springframework.security</groupId>
97-
<artifactId>spring-security-ldap</artifactId>
98-
<version>3.2.4.RELEASE</version>
99-
</dependency>
100-
10136
<dependency>
10237
<groupId>org.springframework.ldap</groupId>
10338
<artifactId>spring-ldap-core</artifactId>
@@ -108,103 +43,17 @@
10843
<artifactId>spring-ldap-core-tiger</artifactId>
10944
<version>2.0.2.RELEASE</version>
11045
</dependency>
111-
112-
<dependency>
113-
<!-- Is the ApacheDS server; as noted above, 1.5.6 and 1.5.7 don't work -->
114-
<groupId>org.apache.directory.server</groupId>
115-
<artifactId>apacheds-server-jndi</artifactId>
116-
<version>1.5.5</version>
117-
</dependency>
118-
<dependency>
119-
<!-- Required by ApacheDS, but not listed in its POM -->
120-
<groupId>commons-collections</groupId>
121-
<artifactId>commons-collections</artifactId>
122-
<version>3.2.1</version>
123-
</dependency>
124-
<dependency>
125-
<groupId>org.apache.mina</groupId>
126-
<artifactId>mina-core</artifactId>
127-
<version>2.0.7</version>
128-
</dependency>
129-
130-
131-
132-
<!-- web -->
133-
134-
<dependency>
135-
<groupId>javax.servlet</groupId>
136-
<artifactId>javax.servlet-api</artifactId>
137-
<version>3.0.1</version>
138-
<scope>provided</scope>
139-
</dependency>
14046

14147
<dependency>
142-
<groupId>javax.servlet</groupId>
143-
<artifactId>jstl</artifactId>
144-
<version>1.2</version>
145-
<scope>runtime</scope>
146-
</dependency>
147-
148-
<!-- util -->
149-
150-
<dependency>
151-
<groupId>com.google.guava</groupId>
152-
<artifactId>guava</artifactId>
153-
<version>14.0.1</version>
154-
</dependency>
155-
156-
<!-- logging -->
157-
158-
<dependency>
159-
<groupId>org.slf4j</groupId>
160-
<artifactId>slf4j-api</artifactId>
161-
<version>${org.slf4j.version}</version>
162-
</dependency>
163-
<dependency>
164-
<groupId>ch.qos.logback</groupId>
165-
<artifactId>logback-classic</artifactId>
166-
<version>${logback.version}</version>
167-
<!-- <scope>runtime</scope> -->
168-
</dependency>
169-
<dependency>
170-
<groupId>org.slf4j</groupId>
171-
<artifactId>jcl-over-slf4j</artifactId>
172-
<version>${org.slf4j.version}</version>
173-
<!-- <scope>runtime</scope> --> <!-- some spring dependencies need to compile against jcl -->
174-
</dependency>
175-
<dependency> <!-- needed to bridge to slf4j for projects that use the log4j APIs directly -->
176-
<groupId>org.slf4j</groupId>
177-
<artifactId>log4j-over-slf4j</artifactId>
178-
<version>${org.slf4j.version}</version>
179-
</dependency>
180-
181-
<!-- test scoped -->
182-
183-
<dependency>
184-
<groupId>junit</groupId>
185-
<artifactId>junit-dep</artifactId>
186-
<version>${junit.version}</version>
187-
<scope>test</scope>
188-
</dependency>
189-
190-
<dependency>
191-
<groupId>org.hamcrest</groupId>
192-
<artifactId>hamcrest-core</artifactId>
193-
<version>${org.hamcrest.version}</version>
194-
<scope>test</scope>
48+
<!-- Is the ApacheDS server - 1.5.6 and 1.5.7 don't work -->
49+
<groupId>org.apache.directory.server</groupId>
50+
<artifactId>apacheds-server-jndi</artifactId>
51+
<version>1.5.5</version>
19552
</dependency>
19653
<dependency>
197-
<groupId>org.hamcrest</groupId>
198-
<artifactId>hamcrest-library</artifactId>
199-
<version>${org.hamcrest.version}</version>
200-
<scope>test</scope>
201-
</dependency>
202-
203-
<dependency>
204-
<groupId>org.mockito</groupId>
205-
<artifactId>mockito-core</artifactId>
206-
<version>${mockito.version}</version>
207-
<scope>test</scope>
54+
<groupId>org.apache.mina</groupId>
55+
<artifactId>mina-core</artifactId>
56+
<version>2.0.7</version>
20857
</dependency>
20958

21059
</dependencies>
@@ -217,100 +66,9 @@
21766
<filtering>true</filtering>
21867
</resource>
21968
</resources>
220-
221-
<plugins>
222-
223-
<plugin>
224-
<groupId>org.apache.maven.plugins</groupId>
225-
<artifactId>maven-compiler-plugin</artifactId>
226-
<version>${maven-compiler-plugin.version}</version>
227-
<configuration>
228-
<source>1.7</source>
229-
<target>1.7</target>
230-
</configuration>
231-
</plugin>
232-
233-
<plugin>
234-
<groupId>org.apache.maven.plugins</groupId>
235-
<artifactId>maven-war-plugin</artifactId>
236-
<version>${maven-war-plugin.version}</version>
237-
</plugin>
238-
239-
<plugin>
240-
<groupId>org.apache.maven.plugins</groupId>
241-
<artifactId>maven-surefire-plugin</artifactId>
242-
<version>${maven-surefire-plugin.version}</version>
243-
<configuration>
244-
<excludes>
245-
<!-- <exclude>**/*ProductionTest.java</exclude> -->
246-
</excludes>
247-
<systemPropertyVariables>
248-
<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
249-
</systemPropertyVariables>
250-
</configuration>
251-
</plugin>
252-
253-
<plugin>
254-
<groupId>org.codehaus.cargo</groupId>
255-
<artifactId>cargo-maven2-plugin</artifactId>
256-
<version>${cargo-maven2-plugin.version}</version>
257-
<configuration>
258-
<wait>true</wait>
259-
<container>
260-
<containerId>jetty8x</containerId>
261-
<type>embedded</type>
262-
<systemProperties>
263-
<!-- <provPersistenceTarget>cargo</provPersistenceTarget> -->
264-
</systemProperties>
265-
</container>
266-
<configuration>
267-
<properties>
268-
<cargo.servlet.port>8082</cargo.servlet.port>
269-
</properties>
270-
</configuration>
271-
</configuration>
272-
</plugin>
273-
274-
</plugins>
275-
27669
</build>
27770

27871
<properties>
279-
<!-- Spring -->
280-
<org.springframework.version>4.0.5.RELEASE</org.springframework.version>
281-
<org.springframework.security.version>3.2.4.RELEASE</org.springframework.security.version>
282-
283-
<!-- persistence -->
284-
<hibernate.version>4.3.5.Final</hibernate.version>
285-
<mysql-connector-java.version>5.1.30</mysql-connector-java.version>
286-
287-
<!-- logging -->
288-
<org.slf4j.version>1.7.6</org.slf4j.version>
289-
<logback.version>1.1.1</logback.version>
290-
291-
<!-- various -->
292-
<hibernate-validator.version>5.1.1.Final</hibernate-validator.version>
293-
294-
<!-- util -->
295-
<guava.version>17.0</guava.version>
296-
<commons-lang3.version>3.3.2</commons-lang3.version>
297-
298-
<!-- testing -->
299-
<org.hamcrest.version>1.3</org.hamcrest.version>
300-
<junit.version>4.11</junit.version>
301-
<mockito.version>1.9.5</mockito.version>
302-
303-
<httpcore.version>4.3.2</httpcore.version>
304-
<httpclient.version>4.3.3</httpclient.version>
305-
306-
<rest-assured.version>2.3.1</rest-assured.version>
307-
308-
<!-- Maven plugins -->
309-
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
310-
<maven-war-plugin.version>2.4</maven-war-plugin.version>
311-
<maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
312-
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
313-
<cargo-maven2-plugin.version>1.4.8</cargo-maven2-plugin.version>
31472

31573
</properties>
31674

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.baeldung;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5+
import org.springframework.context.annotation.ComponentScan;
6+
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
7+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
8+
9+
/**
10+
* Main Application Class - uses Spring Boot. Just run this as a normal Java
11+
* class to run up a Jetty Server (on http://localhost:8080)
12+
*
13+
*/
14+
@EnableAutoConfiguration
15+
@ComponentScan("org.baeldung")
16+
public class SampleLDAPApplication extends WebMvcConfigurerAdapter {
17+
18+
public static void main(String[] args) {
19+
SpringApplication.run(SampleLDAPApplication.class, args);
20+
}
21+
22+
@Override
23+
public void addViewControllers(ViewControllerRegistry registry) {
24+
registry.addViewController("/login").setViewName("login");
25+
}
26+
27+
}

spring-security-mvc-ldap/src/main/java/org/baeldung/controller/HomeController.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)