Skip to content

Commit 6b10b32

Browse files
committed
cleanup and upgrade
1 parent 4a02995 commit 6b10b32

10 files changed

Lines changed: 42 additions & 76 deletions

File tree

‎spring-all/pom.xml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
<dependency>
129129
<groupId>junit</groupId>
130130
<artifactId>junit</artifactId>
131-
<version>${junit.version}</version>
132131
<scope>test</scope>
133132
</dependency>
134133

@@ -164,7 +163,6 @@
164163
<plugin>
165164
<groupId>org.apache.maven.plugins</groupId>
166165
<artifactId>maven-compiler-plugin</artifactId>
167-
<version>${maven-compiler-plugin.version}</version>
168166
<configuration>
169167
<source>1.8</source>
170168
<target>1.8</target>
@@ -174,7 +172,6 @@
174172
<plugin>
175173
<groupId>org.apache.maven.plugins</groupId>
176174
<artifactId>maven-war-plugin</artifactId>
177-
<version>${maven-war-plugin.version}</version>
178175
<configuration>
179176
<failOnMissingWebXml>false</failOnMissingWebXml>
180177
</configuration>
@@ -183,7 +180,6 @@
183180
<plugin>
184181
<groupId>org.apache.maven.plugins</groupId>
185182
<artifactId>maven-surefire-plugin</artifactId>
186-
<version>${maven-surefire-plugin.version}</version>
187183
<configuration>
188184
<excludes>
189185
<!-- <exclude>**/*ProductionTest.java</exclude> -->

‎spring-katharsis/pom.xml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>io.katharsis</groupId>
3333
<artifactId>katharsis-servlet</artifactId>
34-
<version>1.0.0</version>
34+
<version>${katharsis.version}</version>
3535
</dependency>
3636

3737
<!-- test -->
@@ -45,7 +45,7 @@
4545
<dependency>
4646
<groupId>com.jayway.restassured</groupId>
4747
<artifactId>rest-assured</artifactId>
48-
<version>2.4.0</version>
48+
<version>${restassured.version}</version>
4949
<scope>test</scope>
5050
<exclusions>
5151
<exclusion>
@@ -60,6 +60,8 @@
6060

6161
<properties>
6262
<java.version>1.8</java.version>
63+
<katharsis.version>1.0.0</katharsis.version>
64+
<restassured.version>2.4.0</restassured.version>
6365
</properties>
6466

6567

‎spring-security-mvc-ldap/pom.xml‎

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>org.springframework.boot</groupId>
1212
<artifactId>spring-boot-starter-parent</artifactId>
13-
<version>1.2.4.RELEASE</version>
13+
<version>1.3.1.RELEASE</version>
1414
</parent>
1515

1616
<dependencies>
@@ -39,7 +39,7 @@
3939
<!-- Is the ApacheDS server - 1.5.6 and 1.5.7 don't work -->
4040
<groupId>org.apache.directory.server</groupId>
4141
<artifactId>apacheds-server-jndi</artifactId>
42-
<version>1.5.5</version>
42+
<version>${apacheds.version}</version>
4343
</dependency>
4444

4545
</dependencies>
@@ -68,42 +68,8 @@
6868

6969
</build>
7070

71-
<properties>
72-
<!-- Spring -->
73-
<org.springframework.version>4.2.4.RELEASE</org.springframework.version>
74-
<org.springframework.security.version>4.0.3.RELEASE</org.springframework.security.version>
75-
76-
<!-- persistence -->
77-
<hibernate.version>4.3.11.Final</hibernate.version>
78-
<mysql-connector-java.version>5.1.37</mysql-connector-java.version>
79-
80-
<!-- logging -->
81-
<org.slf4j.version>1.7.13</org.slf4j.version>
82-
<logback.version>1.1.3</logback.version>
83-
84-
<!-- various -->
85-
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
86-
87-
<!-- util -->
88-
<guava.version>19.0</guava.version>
89-
<commons-lang3.version>3.4</commons-lang3.version>
90-
91-
<!-- testing -->
92-
<org.hamcrest.version>1.3</org.hamcrest.version>
93-
<junit.version>4.12</junit.version>
94-
<mockito.version>1.10.19</mockito.version>
95-
96-
<httpcore.version>4.4.1</httpcore.version>
97-
<httpclient.version>4.5</httpclient.version>
98-
99-
<rest-assured.version>2.4.1</rest-assured.version>
100-
101-
<!-- Maven plugins -->
102-
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
103-
<maven-war-plugin.version>2.6</maven-war-plugin.version>
104-
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
105-
<cargo-maven2-plugin.version>1.4.15</cargo-maven2-plugin.version>
106-
71+
<properties>
72+
<apacheds.version>1.5.5</apacheds.version>
10773
</properties>
10874

10975
</project>

‎spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Security Configuration - LDAP and HTTP Authorizations.
1010
*/
1111
@Configuration
12-
// @ImportResource({ "classpath:webSecurityConfig.xml" })
12+
// @ImportResource({ "classpath:webSecurityConfig.xml" }) //=> uncomment to use equivalent xml config
1313
public class SecurityConfig extends WebSecurityConfigurerAdapter {
1414

1515
@Override
@@ -20,7 +20,7 @@ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
2020
@Override
2121
protected void configure(HttpSecurity http) throws Exception {
2222
http.authorizeRequests().antMatchers("/", "/home").permitAll().anyRequest().authenticated();
23-
http.formLogin().loginPage("/login").permitAll().loginProcessingUrl("/j_spring_security_check").and().logout().logoutSuccessUrl("/");
23+
http.formLogin().loginPage("/login").permitAll().and().logout().logoutSuccessUrl("/");
2424
}
2525

2626
}

‎spring-security-mvc-ldap/src/main/resources/templates/login.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<p th:if="${param.logout}" class="alert">You have been logged out</p>
2222
<p th:if="${param.error}" class="alert alert-error">There was an error, please try again</p>
2323
<h2>Login with Username and Password</h2>
24-
<form name="form" th:action="@{/j_spring_security_check}" action="/login" method="POST">
24+
<form name="form" th:action="@{/login}" method="POST">
2525
<fieldset>
2626
<input type="text" name="username" value="" placeholder="Username" />
2727
<input type="password" name="password" placeholder="Password" />

‎spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
<intercept-url pattern="/login" access="permitAll"/>
1414
<intercept-url pattern="/secure" access="isAuthenticated()"/>
1515

16-
<form-login login-page='/login' default-target-url="/"
17-
authentication-failure-url="/login?error"
18-
username-parameter="username"
19-
password-parameter="password"/>
16+
<form-login login-page='/login' default-target-url="/" authentication-failure-url="/login?error" />
2017
<logout logout-success-url="/" />
2118
</http>
2219

‎spring-security-rest-full/pom.xml‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>org.springframework.boot</groupId>
1212
<artifactId>spring-boot-starter-parent</artifactId>
13-
<version>1.3.0.RELEASE</version>
13+
<version>1.3.1.RELEASE</version>
1414
</parent>
1515

1616
<dependencies>
@@ -113,20 +113,20 @@
113113
<dependency>
114114
<groupId>com.mysema.querydsl</groupId>
115115
<artifactId>querydsl-apt</artifactId>
116-
<version>3.6.2</version>
116+
<version>${querydsl.version}</version>
117117
</dependency>
118118
<dependency>
119119
<groupId>com.mysema.querydsl</groupId>
120120
<artifactId>querydsl-jpa</artifactId>
121-
<version>3.6.2</version>
121+
<version>${querydsl.version}</version>
122122
</dependency>
123123

124124
<!-- Rsql -->
125125

126126
<dependency>
127127
<groupId>cz.jirutka.rsql</groupId>
128128
<artifactId>rsql-parser</artifactId>
129-
<version>2.0.0</version>
129+
<version>${rsql.version}</version>
130130
</dependency>
131131

132132
<!-- web -->
@@ -144,7 +144,6 @@
144144
<dependency>
145145
<groupId>org.apache.httpcomponents</groupId>
146146
<artifactId>httpcore</artifactId>
147-
<version>${httpcore.version}</version>
148147
</dependency>
149148

150149
<!-- persistence -->
@@ -164,7 +163,7 @@
164163
<dependency>
165164
<groupId>xml-apis</groupId>
166165
<artifactId>xml-apis</artifactId>
167-
<version>1.4.01</version>
166+
<version>${xml-apis.version}</version>
168167
</dependency>
169168
<dependency>
170169
<groupId>org.javassist</groupId>
@@ -200,7 +199,7 @@
200199
<dependency>
201200
<groupId>com.thoughtworks.xstream</groupId>
202201
<artifactId>xstream</artifactId>
203-
<version>1.4.8</version>
202+
<version>${xstream.version}</version>
204203
</dependency>
205204

206205
<!-- util -->
@@ -243,7 +242,6 @@
243242
<dependency>
244243
<groupId>junit</groupId>
245244
<artifactId>junit</artifactId>
246-
<version>${junit.version}</version>
247245
<scope>test</scope>
248246
</dependency>
249247

@@ -267,7 +265,7 @@
267265
<dependency>
268266
<groupId>com.jayway.restassured</groupId>
269267
<artifactId>rest-assured</artifactId>
270-
<version>2.4.0</version>
268+
<version>${rest-assured.version}</version>
271269
<scope>test</scope>
272270
<exclusions>
273271
<exclusion>
@@ -344,7 +342,7 @@
344342
<plugin>
345343
<groupId>com.mysema.maven</groupId>
346344
<artifactId>apt-maven-plugin</artifactId>
347-
<version>1.1.3</version>
345+
<version>${apt-maven-plugin.version}</version>
348346
<executions>
349347
<execution>
350348
<goals>
@@ -434,16 +432,20 @@
434432
<mysql-connector-java.version>5.1.37</mysql-connector-java.version>
435433
<spring-data-jpa.version>1.7.2.RELEASE</spring-data-jpa.version>
436434

435+
<rsql.version>2.0.0</rsql.version>
436+
<querydsl.version>3.6.2</querydsl.version>
437+
437438
<!-- marshalling -->
438-
439439
<jackson.version>2.5.5</jackson.version>
440+
<xml-apis.version>1.4.01</xml-apis.version>
440441

441442
<!-- logging -->
442443
<org.slf4j.version>1.7.13</org.slf4j.version>
443444
<logback.version>1.1.3</logback.version>
444445

445446
<!-- various -->
446447
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
448+
<xstream.version>1.4.8</xstream.version>
447449

448450
<!-- util -->
449451
<guava.version>19.0</guava.version>
@@ -464,7 +466,7 @@
464466
<maven-war-plugin.version>2.6</maven-war-plugin.version>
465467
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
466468
<cargo-maven2-plugin.version>1.4.15</cargo-maven2-plugin.version>
467-
469+
<apt-maven-plugin.version>1.1.3</apt-maven-plugin.version>
468470
</properties>
469471

470472
</project>

‎spring-security-rest/pom.xml‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@
8282
<dependency>
8383
<groupId>javax.servlet</groupId>
8484
<artifactId>javax.servlet-api</artifactId>
85-
<version>3.0.1</version>
85+
<version>${javax.servlet-api.version}</version>
8686
<scope>provided</scope>
8787
</dependency>
8888

8989
<dependency>
9090
<groupId>javax.servlet</groupId>
9191
<artifactId>jstl</artifactId>
92-
<version>1.2</version>
92+
<version>${jstl.version}</version>
9393
<scope>runtime</scope>
9494
</dependency>
9595

@@ -98,7 +98,7 @@
9898
<dependency>
9999
<groupId>com.fasterxml.jackson.core</groupId>
100100
<artifactId>jackson-databind</artifactId>
101-
<version>2.2.2</version>
101+
<version>${jackson.version}</version>
102102
</dependency>
103103

104104
<!-- util -->
@@ -111,7 +111,7 @@
111111
<dependency>
112112
<groupId>org.apache.commons</groupId>
113113
<artifactId>commons-lang3</artifactId>
114-
<version>3.1</version>
114+
<version>${commons-lang3.version}</version>
115115
</dependency>
116116
<!-- logging -->
117117

@@ -171,13 +171,13 @@
171171
<dependency>
172172
<groupId>io.springfox</groupId>
173173
<artifactId>springfox-swagger2</artifactId>
174-
<version>2.2.2</version>
174+
<version>${springfox.version}</version>
175175
</dependency>
176176

177177
<dependency>
178178
<groupId>io.springfox</groupId>
179179
<artifactId>springfox-swagger-ui</artifactId>
180-
<version>2.2.2</version>
180+
<version>${springfox.version}</version>
181181
</dependency>
182182

183183
</dependencies>
@@ -263,7 +263,11 @@
263263

264264
<!-- various -->
265265
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
266-
266+
<javax.servlet-api.version>3.0.1</javax.servlet-api.version>
267+
<jstl.version>1.2</jstl.version>
268+
<jackson.version>2.2.2</jackson.version>
269+
<springfox.version>2.2.2</springfox.version>
270+
267271
<!-- util -->
268272
<guava.version>19.0</guava.version>
269273
<commons-lang3.version>3.4</commons-lang3.version>

‎spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,16 @@ protected void configure(final AuthenticationManagerBuilder auth) throws Excepti
3535
}
3636

3737
@Override
38-
protected void configure(final HttpSecurity http) throws Exception { // @formatter:off
38+
protected void configure(final HttpSecurity http) throws Exception {// @formatter:off
3939
http
4040
.csrf().disable()
4141
.exceptionHandling()
4242
.authenticationEntryPoint(restAuthenticationEntryPoint)
4343
.and()
4444
.authorizeRequests()
45-
.antMatchers("/api/foos").authenticated()
45+
.antMatchers("/api/**").authenticated()
4646
.and()
4747
.formLogin()
48-
.loginProcessingUrl("/j_spring_security_check")
49-
.usernameParameter("j_username")
50-
.passwordParameter("j_password")
5148
.successHandler(authenticationSuccessHandler)
5249
.failureHandler(new SimpleUrlAuthenticationFailureHandler())
5350
.and()

‎spring-security-rest/src/main/resources/webSecurityConfig.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<http use-expressions="true" entry-point-ref="restAuthenticationEntryPoint">
1212
<intercept-url pattern="/api/**" access="isAuthenticated()"/>
1313

14-
<sec:form-login authentication-success-handler-ref="mySuccessHandler" authentication-failure-handler-ref="myFailureHandler"/>
14+
<csrf disabled="true"/>
15+
16+
<form-login authentication-success-handler-ref="mySuccessHandler" authentication-failure-handler-ref="myFailureHandler"/>
1517

1618
<logout/>
1719
</http>

0 commit comments

Comments
 (0)